fix clippy warnings #57

Merged
rhetenor merged 6 commits from rhetenor/errorview-show-error-in-nfc-module AGit into main 2026-08-30 11:26:49 +02:00
2 changed files with 15 additions and 4 deletions
Showing only changes of commit 5ac8fe9610 - Show all commits
+11 -2
View File
@@ -34,6 +34,15 @@ impl Navigable for ErrorView {
_: &Peripherals, _: &Peripherals,
) -> impl core::future::Future<Output = Result<(), Box<dyn error::Error>>> + Send { ) -> impl core::future::Future<Output = Result<(), Box<dyn error::Error>>> + Send {
async move { async move {
outputs
.primary_display
.clear(Rgb565::BLACK)
.unwrap_or_else(|error| {
panic!(
"Error: {error:?}\nDraw error while rendering ErrorView: {}",
self.error
)
});
let style = MonoTextStyle::new(&FONT_10X20, Rgb565::RED); let style = MonoTextStyle::new(&FONT_10X20, Rgb565::RED);
let display_area = outputs.primary_display.bounding_box(); let display_area = outputs.primary_display.bounding_box();
Text::new( Text::new(
@@ -44,7 +53,7 @@ impl Navigable for ErrorView {
.draw(&mut outputs.primary_display) .draw(&mut outputs.primary_display)
.unwrap_or_else(|error| { .unwrap_or_else(|error| {
panic!( panic!(
"Error: {error:?}\nDraw error while rendering error: {}", "Error: {error:?}\nDraw error while rendering ErrorView: {}",
self.error self.error
) )
}); });
@@ -61,7 +70,7 @@ impl Navigable for ErrorView {
.draw(&mut outputs.primary_display) .draw(&mut outputs.primary_display)
.unwrap_or_else(|error| { .unwrap_or_else(|error| {
panic!( panic!(
"Error: {error:?}\nDraw error while rendering error: {}", "Error: {error:?}\nDraw error while rendering ErrorView: {}",
self.error self.error
) )
}); });
+4 -2
View File
@@ -12,7 +12,7 @@ use embedded_graphics::pixelcolor::Rgb565;
use embedded_graphics::prelude::RgbColor; use embedded_graphics::prelude::RgbColor;
use embedded_graphics_core::draw_target::DrawTarget; use embedded_graphics_core::draw_target::DrawTarget;
pub const MAX_SELECTED: i32 = 2; pub const MAX_SELECTED: i32 = 3;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct SettingsMenu { pub struct SettingsMenu {
@@ -27,7 +27,9 @@ impl Navigable for SettingsMenu {
) -> impl core::future::Future<Output = Result<(), Box<dyn error::Error>>> + Send { ) -> impl core::future::Future<Output = Result<(), Box<dyn error::Error>>> + Send {
async move { async move {
let display = &mut outputs.primary_display; let display = &mut outputs.primary_display;
display.clear(Rgb565::BLACK).unwrap(); display
.clear(Rgb565::BLACK)
.map_err(PrimaryDisplayError::from)?;
menu_item::show(display, "System Inforation", 0, self.selected) menu_item::show(display, "System Inforation", 0, self.selected)
.map_err(PrimaryDisplayError::from)?; .map_err(PrimaryDisplayError::from)?;
menu_item::show(display, "Wifi Information", 1, self.selected) menu_item::show(display, "Wifi Information", 1, self.selected)