clippy fixes

This commit was merged in pull request #52.
This commit is contained in:
2026-08-29 23:40:22 +02:00
parent e2853bc9ab
commit aa7fc94068
3 changed files with 39 additions and 45 deletions
+6 -7
View File
@@ -1,4 +1,3 @@
use crate::alloc::string::ToString;
use crate::card::model::Card; use crate::card::model::Card;
use crate::navigation::inputs::ButtonAction; use crate::navigation::inputs::ButtonAction;
use crate::navigation::inputs::Inputs; use crate::navigation::inputs::Inputs;
@@ -9,6 +8,7 @@ use crate::views::error_view::ErrorView;
use crate::views::view::View; use crate::views::view::View;
use alloc::boxed::Box; use alloc::boxed::Box;
use alloc::string::String; use alloc::string::String;
use alloc::string::ToString;
use core::error; use core::error;
use embassy_futures::select::{Either, select}; use embassy_futures::select::{Either, select};
@@ -74,7 +74,7 @@ pub async fn run(mut inputs: Inputs, mut outputs: Outputs, peripherals: &'static
.display(&mut outputs, peripherals) .display(&mut outputs, peripherals)
.await .await
{ {
display_error(error.to_string(), &mut state, &mut outputs, &peripherals).await; display_error(error.to_string(), &mut state, &mut outputs, peripherals).await;
}; };
loop { loop {
@@ -120,16 +120,15 @@ pub async fn run(mut inputs: Inputs, mut outputs: Outputs, peripherals: &'static
} }
state.screens.push(new_state.view); state.screens.push(new_state.view);
if action != Action::Timer || new_state.redraw { if (action != Action::Timer || new_state.redraw)
if let Err(error) = state && let Err(error) = state
.screens .screens
.last() .last()
.unwrap() .unwrap()
.display(&mut outputs, peripherals) .display(&mut outputs, peripherals)
.await .await
{ {
display_error(error.to_string(), &mut state, &mut outputs, &peripherals).await; display_error(error.to_string(), &mut state, &mut outputs, peripherals).await;
}
} }
Timer::after(Duration::from_millis(DEBOUNCE_DURATION_MILLIS)).await; Timer::after(Duration::from_millis(DEBOUNCE_DURATION_MILLIS)).await;
+17 -19
View File
@@ -5,8 +5,8 @@ use crate::navigation::outputs::Outputs;
use crate::peripherals::Peripherals; use crate::peripherals::Peripherals;
use crate::views::view::View; use crate::views::view::View;
use alloc::boxed::Box; use alloc::boxed::Box;
use alloc::format;
use alloc::string::String; use alloc::string::String;
use alloc::string::ToString;
use core::error; use core::error;
use embedded_graphics::{ use embedded_graphics::{
Drawable, Drawable,
@@ -57,7 +57,7 @@ impl Navigable for ErrorView {
let bounds = Rectangle::new(Point::new(0, 30), display_area.size); let bounds = Rectangle::new(Point::new(0, 30), display_area.size);
TextBox::with_textbox_style(&format!("{}", self.error), bounds, style, textbox_style) TextBox::with_textbox_style(&self.error.to_string(), bounds, style, textbox_style)
.draw(&mut outputs.primary_display) .draw(&mut outputs.primary_display)
.unwrap_or_else(|error| { .unwrap_or_else(|error| {
panic!( panic!(
@@ -71,23 +71,21 @@ impl Navigable for ErrorView {
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = NewState> + Send { fn handle_input(&self, input: Action) -> impl core::future::Future<Output = NewState> + Send {
async move { async move {
let Action::Button(input) = input else { let new_menu = View::Error(self.clone());
// Skip timer inputs match input {
return NewState { Action::Button(_) => NewState {
view: View::Error(self.clone()), replace_view: matches!(new_menu, View::FlashInfo(_)),
replace_view: true, view: new_menu,
redraw: false, redraw: true,
}; },
}; Action::Timer => {
// Skip timer inputs
let new_menu = match input { NewState {
_ => View::Error(self.clone()), view: new_menu,
}; replace_view: true,
redraw: false,
NewState { }
replace_view: matches!(new_menu, View::FlashInfo(_)), }
view: new_menu,
redraw: true,
} }
} }
} }
+16 -19
View File
@@ -16,7 +16,6 @@ use embedded_graphics::{
pixelcolor::Rgb565, pixelcolor::Rgb565,
prelude::*, prelude::*,
primitives::Rectangle, primitives::Rectangle,
text::Text,
}; };
use alloc::format; use alloc::format;
@@ -35,7 +34,7 @@ impl Navigable for FlashInfoView {
peripherals: &Peripherals, 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 {
let style = MonoTextStyle::new(&FONT_10X20, Rgb565::WHITE); let _style = MonoTextStyle::new(&FONT_10X20, Rgb565::WHITE);
let mut magic_bytes: [u8; MAGIC_REGION.size] = [0; MAGIC_REGION.size]; let mut magic_bytes: [u8; MAGIC_REGION.size] = [0; MAGIC_REGION.size];
peripherals peripherals
.store .store
@@ -83,23 +82,21 @@ Card Count: {}\n
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = NewState> + Send { fn handle_input(&self, input: Action) -> impl core::future::Future<Output = NewState> + Send {
async move { async move {
let Action::Button(input) = input else { let new_menu = View::FlashInfo(self.clone());
// Skip timer inputs match input {
return NewState { Action::Button(_) => NewState {
view: View::FlashInfo(self.clone()), replace_view: matches!(new_menu, View::FlashInfo(_)),
replace_view: true, view: new_menu,
redraw: false, redraw: true,
}; },
}; Action::Timer => {
// Skip timer inputs
let new_menu = match input { NewState {
_ => View::FlashInfo(self.clone()), view: new_menu,
}; replace_view: true,
redraw: false,
NewState { }
replace_view: matches!(new_menu, View::FlashInfo(_)), }
view: new_menu,
redraw: true,
} }
} }
} }