diff --git a/src/action.rs b/src/action.rs index 19f48ca..ce64275 100644 --- a/src/action.rs +++ b/src/action.rs @@ -15,7 +15,9 @@ use crate::action_raw::RawAction; #[derive(Clone, Copy, Debug, Deserialize_repr)] #[repr(u8)] #[derive(Eq, PartialEq)] +#[derive(Default)] pub enum ActionType { + #[default] Unknown = 0, CopyPath = 100, FileTransfer = 101, @@ -32,11 +34,6 @@ pub enum ActionType { FetchTree = 112, } -impl Default for ActionType { - fn default() -> Self { - Self::Unknown - } -} // --- // --- BuildStepId diff --git a/src/handlers/download.rs b/src/handlers/download.rs index be4964c..eb8e590 100644 --- a/src/handlers/download.rs +++ b/src/handlers/download.rs @@ -23,7 +23,7 @@ impl Handler for SubstituteHandler { ) -> color_eyre::Result { match action { Action::Start { - start_type: StartFields::Substitute { source, target }, + start_type: StartFields::Substitute { .. }, id, .. } => { diff --git a/src/handlers/substitute_status.rs b/src/handlers/substitute_status.rs index 3c1d8db..bfe08b4 100644 --- a/src/handlers/substitute_status.rs +++ b/src/handlers/substitute_status.rs @@ -160,7 +160,7 @@ impl Handler for SubstitutionStatusHandler { ) -> color_eyre::Result { match action { Action::Start { - start_type: StartFields::CopyPath { path, .. }, + start_type: StartFields::CopyPath { .. }, id, .. } => { @@ -177,24 +177,24 @@ impl Handler for SubstitutionStatusHandler { } Action::Result { - id, fields: ResultFields::SetExpected { action: ActionType::FileTransfer, expected, }, + .. } => { self.max_transfer = *expected; self.draw_bar(state.term_width); Ok(true) } Action::Result { - id, fields: ResultFields::SetExpected { action: ActionType::CopyPath, expected, }, + .. } => { self.max_copy = *expected; self.draw_bar(state.term_width); diff --git a/src/multibar.rs b/src/multibar.rs index cef2ed6..429e87b 100644 --- a/src/multibar.rs +++ b/src/multibar.rs @@ -16,7 +16,7 @@ impl<'s> BarSegment<'s> { fn length(&self) -> u64 { match self { - BarSegment::Dynamic(c, len) => *len, + BarSegment::Dynamic(_c, len) => *len, BarSegment::Static(c) => c.len() as u64, } } diff --git a/src/nix_path.rs b/src/nix_path.rs index 6947e22..40dbc5f 100644 --- a/src/nix_path.rs +++ b/src/nix_path.rs @@ -16,7 +16,7 @@ pub fn extract_package_name(path: &str) -> Option> { let name_parts: Vec<&str> = parts .iter() - .take_while(|part| !part.chars().next().map_or(false, |c| c.is_ascii_digit())) + .take_while(|part| !part.chars().next().is_some_and(|c| c.is_ascii_digit())) .copied() .collect(); diff --git a/src/state.rs b/src/state.rs index 3f97d08..3aba4b8 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1,4 +1,4 @@ -use std::{io, marker::PhantomData, rc::Rc}; +use std::{io, rc::Rc}; use console::style; use indicatif::{MultiProgress, ProgressBar, ProgressFinish, ProgressStyle};