release clippy fixes
This commit is contained in:
@@ -208,6 +208,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/cache/mod.rs
vendored
6
src/cache/mod.rs
vendored
@@ -9,6 +9,12 @@ pub struct SimpleCache<T: Clone> {
|
|||||||
collection: BTreeMap<u32, T>,
|
collection: BTreeMap<u32, T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Clone> Default for SimpleCache<T> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Clone> SimpleCache<T> {
|
impl<T: Clone> SimpleCache<T> {
|
||||||
/// Create new Empty Cache
|
/// Create new Empty Cache
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ pub struct ImageSimulator {
|
|||||||
buffer: Framebuffer<BinaryColor, RawU1, BigEndian, WIDTH, HEIGHT, { WIDTH * HEIGHT }>,
|
buffer: Framebuffer<BinaryColor, RawU1, BigEndian, WIDTH, HEIGHT, { WIDTH * HEIGHT }>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ImageSimulator {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ImageSimulator {
|
impl ImageSimulator {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -63,7 +69,7 @@ impl ImageSimulator {
|
|||||||
// Draw Alliance logo (64x64) if present
|
// Draw Alliance logo (64x64) if present
|
||||||
if let Some(alliance) = &kill.victim.alliance {
|
if let Some(alliance) = &kill.victim.alliance {
|
||||||
let bw_vec = rgb_to_bw_dithered(&alliance.logo);
|
let bw_vec = rgb_to_bw_dithered(&alliance.logo);
|
||||||
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, alliance.logo.width() as u32);
|
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, alliance.logo.width());
|
||||||
Image::new(&logo_raw, Point::new(x, y))
|
Image::new(&logo_raw, Point::new(x, y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -72,7 +78,7 @@ impl ImageSimulator {
|
|||||||
// Draw Ship icon (64x64) if present
|
// Draw Ship icon (64x64) if present
|
||||||
if let Some(ship) = &kill.victim.ship {
|
if let Some(ship) = &kill.victim.ship {
|
||||||
let bw_vec = rgb_to_bw_dithered(&ship.icon);
|
let bw_vec = rgb_to_bw_dithered(&ship.icon);
|
||||||
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, ship.icon.width() as u32);
|
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, ship.icon.width());
|
||||||
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -132,7 +138,7 @@ impl ImageSimulator {
|
|||||||
// Draw Alliance logo (64x64) if present
|
// Draw Alliance logo (64x64) if present
|
||||||
if let Some(character) = &kill.victim.character {
|
if let Some(character) = &kill.victim.character {
|
||||||
let bw_vec = rgb_to_bw_dithered(&character.portrait);
|
let bw_vec = rgb_to_bw_dithered(&character.portrait);
|
||||||
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, character.portrait.width() as u32);
|
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, character.portrait.width());
|
||||||
Image::new(&logo_raw, Point::new(x, y))
|
Image::new(&logo_raw, Point::new(x, y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -141,7 +147,7 @@ impl ImageSimulator {
|
|||||||
// Draw Ship icon (64x64) if present
|
// Draw Ship icon (64x64) if present
|
||||||
if let Some(ship) = &kill.victim.ship {
|
if let Some(ship) = &kill.victim.ship {
|
||||||
let bw_vec = rgb_to_bw_dithered(&ship.icon);
|
let bw_vec = rgb_to_bw_dithered(&ship.icon);
|
||||||
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, ship.icon.width() as u32);
|
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, ship.icon.width());
|
||||||
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -234,7 +240,7 @@ impl KillDisplay for ImageSimulator {
|
|||||||
// Draw Alliance logo (64x64) if present
|
// Draw Alliance logo (64x64) if present
|
||||||
if let Some(alliance) = &kill.victim.alliance {
|
if let Some(alliance) = &kill.victim.alliance {
|
||||||
let bw_vec = rgb_to_bw_dithered(&alliance.logo);
|
let bw_vec = rgb_to_bw_dithered(&alliance.logo);
|
||||||
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, alliance.logo.width() as u32);
|
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, alliance.logo.width());
|
||||||
Image::new(&logo_raw, Point::new(x, y))
|
Image::new(&logo_raw, Point::new(x, y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -243,7 +249,7 @@ impl KillDisplay for ImageSimulator {
|
|||||||
// Draw Ship icon (64x64) if present
|
// Draw Ship icon (64x64) if present
|
||||||
if let Some(ship) = &kill.victim.ship {
|
if let Some(ship) = &kill.victim.ship {
|
||||||
let bw_vec = rgb_to_bw_dithered(&ship.icon);
|
let bw_vec = rgb_to_bw_dithered(&ship.icon);
|
||||||
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, ship.icon.width() as u32);
|
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, ship.icon.width());
|
||||||
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -303,7 +309,7 @@ impl KillDisplay for ImageSimulator {
|
|||||||
// Draw Alliance logo (64x64) if present
|
// Draw Alliance logo (64x64) if present
|
||||||
if let Some(character) = &kill.victim.character {
|
if let Some(character) = &kill.victim.character {
|
||||||
let bw_vec = rgb_to_bw_dithered(&character.portrait);
|
let bw_vec = rgb_to_bw_dithered(&character.portrait);
|
||||||
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, character.portrait.width() as u32);
|
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, character.portrait.width());
|
||||||
Image::new(&logo_raw, Point::new(x, y))
|
Image::new(&logo_raw, Point::new(x, y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -312,7 +318,7 @@ impl KillDisplay for ImageSimulator {
|
|||||||
// Draw Ship icon (64x64) if present
|
// Draw Ship icon (64x64) if present
|
||||||
if let Some(ship) = &kill.victim.ship {
|
if let Some(ship) = &kill.victim.ship {
|
||||||
let bw_vec = rgb_to_bw_dithered(&ship.icon);
|
let bw_vec = rgb_to_bw_dithered(&ship.icon);
|
||||||
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, ship.icon.width() as u32);
|
let logo_raw = ImageRaw::<BinaryColor>::new(&bw_vec, ship.icon.width());
|
||||||
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ pub struct Simulator {
|
|||||||
window: Window,
|
window: Window,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Simulator {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Simulator {
|
impl Simulator {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let display = SimulatorDisplay::<Gray8>::new(Size::new(WIDTH as u32, HEIGHT as u32));
|
let display = SimulatorDisplay::<Gray8>::new(Size::new(WIDTH as u32, HEIGHT as u32));
|
||||||
@@ -60,7 +66,7 @@ impl Simulator {
|
|||||||
// Draw Alliance logo (64x64) if present
|
// Draw Alliance logo (64x64) if present
|
||||||
if let Some(alliance) = &kill.victim.alliance {
|
if let Some(alliance) = &kill.victim.alliance {
|
||||||
let bw_vec = rgbimage_to_gray8(&alliance.logo);
|
let bw_vec = rgbimage_to_gray8(&alliance.logo);
|
||||||
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, alliance.logo.width() as u32);
|
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, alliance.logo.width());
|
||||||
Image::new(&logo_raw, Point::new(x, y))
|
Image::new(&logo_raw, Point::new(x, y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -69,7 +75,7 @@ impl Simulator {
|
|||||||
// Draw Ship icon (64x64) if present
|
// Draw Ship icon (64x64) if present
|
||||||
if let Some(ship) = &kill.victim.ship {
|
if let Some(ship) = &kill.victim.ship {
|
||||||
let bw_vec = rgbimage_to_gray8(&ship.icon);
|
let bw_vec = rgbimage_to_gray8(&ship.icon);
|
||||||
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, ship.icon.width() as u32);
|
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, ship.icon.width());
|
||||||
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -129,7 +135,7 @@ impl Simulator {
|
|||||||
// Draw Alliance logo (64x64) if present
|
// Draw Alliance logo (64x64) if present
|
||||||
if let Some(character) = &kill.victim.character {
|
if let Some(character) = &kill.victim.character {
|
||||||
let bw_vec = rgbimage_to_gray8(&character.portrait);
|
let bw_vec = rgbimage_to_gray8(&character.portrait);
|
||||||
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, character.portrait.width() as u32);
|
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, character.portrait.width());
|
||||||
Image::new(&logo_raw, Point::new(x, y))
|
Image::new(&logo_raw, Point::new(x, y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -138,7 +144,7 @@ impl Simulator {
|
|||||||
// Draw Ship icon (64x64) if present
|
// Draw Ship icon (64x64) if present
|
||||||
if let Some(ship) = &kill.victim.ship {
|
if let Some(ship) = &kill.victim.ship {
|
||||||
let bw_vec = rgbimage_to_gray8(&ship.icon);
|
let bw_vec = rgbimage_to_gray8(&ship.icon);
|
||||||
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, ship.icon.width() as u32);
|
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, ship.icon.width());
|
||||||
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -230,7 +236,7 @@ impl KillDisplay for Simulator {
|
|||||||
// Draw Alliance logo (64x64) if present
|
// Draw Alliance logo (64x64) if present
|
||||||
if let Some(alliance) = &kill.victim.alliance {
|
if let Some(alliance) = &kill.victim.alliance {
|
||||||
let bw_vec = rgbimage_to_gray8(&alliance.logo);
|
let bw_vec = rgbimage_to_gray8(&alliance.logo);
|
||||||
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, alliance.logo.width() as u32);
|
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, alliance.logo.width());
|
||||||
Image::new(&logo_raw, Point::new(x, y))
|
Image::new(&logo_raw, Point::new(x, y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -239,7 +245,7 @@ impl KillDisplay for Simulator {
|
|||||||
// Draw Ship icon (64x64) if present
|
// Draw Ship icon (64x64) if present
|
||||||
if let Some(ship) = &kill.victim.ship {
|
if let Some(ship) = &kill.victim.ship {
|
||||||
let bw_vec = rgbimage_to_gray8(&ship.icon);
|
let bw_vec = rgbimage_to_gray8(&ship.icon);
|
||||||
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, ship.icon.width() as u32);
|
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, ship.icon.width());
|
||||||
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -299,7 +305,7 @@ impl KillDisplay for Simulator {
|
|||||||
// Draw Alliance logo (64x64) if present
|
// Draw Alliance logo (64x64) if present
|
||||||
if let Some(character) = &kill.victim.character {
|
if let Some(character) = &kill.victim.character {
|
||||||
let bw_vec = rgbimage_to_gray8(&character.portrait);
|
let bw_vec = rgbimage_to_gray8(&character.portrait);
|
||||||
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, character.portrait.width() as u32);
|
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, character.portrait.width());
|
||||||
Image::new(&logo_raw, Point::new(x, y))
|
Image::new(&logo_raw, Point::new(x, y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -308,7 +314,7 @@ impl KillDisplay for Simulator {
|
|||||||
// Draw Ship icon (64x64) if present
|
// Draw Ship icon (64x64) if present
|
||||||
if let Some(ship) = &kill.victim.ship {
|
if let Some(ship) = &kill.victim.ship {
|
||||||
let bw_vec = rgbimage_to_gray8(&ship.icon);
|
let bw_vec = rgbimage_to_gray8(&ship.icon);
|
||||||
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, ship.icon.width() as u32);
|
let logo_raw = ImageRaw::<Gray8>::new(&bw_vec, ship.icon.width());
|
||||||
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
Image::new(&logo_raw, Point::new(x + 64 + 4, current_y))
|
||||||
.draw(&mut self.buffer)
|
.draw(&mut self.buffer)
|
||||||
.ok();
|
.ok();
|
||||||
@@ -375,5 +381,5 @@ fn rgbimage_to_gray8(raw_img: &RgbImage) -> Vec<u8> {
|
|||||||
gray_data.push(luma);
|
gray_data.push(luma);
|
||||||
}
|
}
|
||||||
|
|
||||||
return gray_data;
|
gray_data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub enum DisplayRotation {
|
|||||||
/// count the number of bytes per line knowing that it may contains padding bits
|
/// count the number of bytes per line knowing that it may contains padding bits
|
||||||
const fn line_bytes(width: u32, bits_per_pixel: usize) -> usize {
|
const fn line_bytes(width: u32, bits_per_pixel: usize) -> usize {
|
||||||
// round to upper 8 bit count
|
// round to upper 8 bit count
|
||||||
(width as usize * bits_per_pixel + 7) / 8
|
(width as usize * bits_per_pixel).div_ceil(8)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Display buffer used for drawing with embedded graphics
|
/// Display buffer used for drawing with embedded graphics
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ pub struct KillInfoBuilder {
|
|||||||
corporation_id: u32,
|
corporation_id: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for KillInfoBuilder {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl KillInfoBuilder {
|
impl KillInfoBuilder {
|
||||||
/// Creates a new builder with default settings.
|
/// Creates a new builder with default settings.
|
||||||
pub fn new() -> KillInfoBuilder {
|
pub fn new() -> KillInfoBuilder {
|
||||||
@@ -79,16 +85,14 @@ impl KillInfoBuilder {
|
|||||||
let main_attacker: Option<Individual> =
|
let main_attacker: Option<Individual> =
|
||||||
self.find_main_attacker(&attacker_list).and_then(|a| {
|
self.find_main_attacker(&attacker_list).and_then(|a| {
|
||||||
// Try to build the Individual. If it fails, return None
|
// Try to build the Individual. If it fails, return None
|
||||||
match Individual::build_with_esi(
|
Individual::build_with_esi(
|
||||||
esi,
|
esi,
|
||||||
a.character_id,
|
a.character_id,
|
||||||
a.corporation_id,
|
a.corporation_id,
|
||||||
a.alliance_id,
|
a.alliance_id,
|
||||||
a.ship_id,
|
a.ship_id,
|
||||||
) {
|
)
|
||||||
Ok(ind) => Some(ind),
|
.ok()
|
||||||
Err(_) => None, // ignore errors here
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let victim = Individual::build_with_esi(
|
let victim = Individual::build_with_esi(
|
||||||
@@ -118,7 +122,7 @@ impl KillInfoBuilder {
|
|||||||
/// the attacker with the highest damage done.
|
/// the attacker with the highest damage done.
|
||||||
pub fn find_main_attacker(
|
pub fn find_main_attacker(
|
||||||
&self,
|
&self,
|
||||||
attacker_list: &Vec<KillmailAttacker>,
|
attacker_list: &[KillmailAttacker],
|
||||||
) -> Option<KillmailAttacker> {
|
) -> Option<KillmailAttacker> {
|
||||||
if attacker_list.is_empty() {
|
if attacker_list.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub mod services;
|
|||||||
/// \[XXXXX210\]\[76543210\]...\[76543210\] | height
|
/// \[XXXXX210\]\[76543210\]...\[76543210\] | height
|
||||||
/// \[XXXXX210\]\[76543210\]...\[76543210\] v
|
/// \[XXXXX210\]\[76543210\]...\[76543210\] v
|
||||||
pub const fn buffer_len(width: usize, height: usize) -> usize {
|
pub const fn buffer_len(width: usize, height: usize) -> usize {
|
||||||
(width + 7) / 8 * height
|
width.div_ceil(8) * height
|
||||||
}
|
}
|
||||||
|
|
||||||
use embedded_hal::spi::{Mode, Phase, Polarity};
|
use embedded_hal::spi::{Mode, Phase, Polarity};
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ pub mod services;
|
|||||||
pub mod epd;
|
pub mod epd;
|
||||||
|
|
||||||
pub const fn buffer_len(width: usize, height: usize) -> usize {
|
pub const fn buffer_len(width: usize, height: usize) -> usize {
|
||||||
(width + 7) / 8 * height
|
width.div_ceil(8) * height
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> () {
|
fn main() {
|
||||||
// Pick the display based on compile-time feature
|
// Pick the display based on compile-time feature
|
||||||
#[cfg(feature = "simulator")]
|
#[cfg(feature = "simulator")]
|
||||||
let display = display::Simulator::new();
|
let display = display::Simulator::new();
|
||||||
|
|||||||
@@ -116,6 +116,12 @@ pub struct EsiClient {
|
|||||||
ship_image_cache: ImageCache,
|
ship_image_cache: ImageCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for EsiClient {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl EsiClient {
|
impl EsiClient {
|
||||||
/// Creates a new `EsiClient` instance with default configuration.
|
/// Creates a new `EsiClient` instance with default configuration.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -131,6 +131,12 @@ pub struct ZkillClient {
|
|||||||
client: Client,
|
client: Client,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ZkillClient {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ZkillClient {
|
impl ZkillClient {
|
||||||
/// Creates a new [`ZkillClient`] with a configured `reqwest::Client`.
|
/// Creates a new [`ZkillClient`] with a configured `reqwest::Client`.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user