diff --git a/src/app.rs b/src/app.rs index b1767c1..d07aff7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -14,16 +14,13 @@ pub use settings::Settings; use std::{fs, path::PathBuf}; #[derive(PartialEq)] +#[derive(Default)] enum PlayerState { PLAYING, + #[default] PAUSED, } -impl Default for PlayerState { - fn default() -> Self { - PlayerState::PAUSED - } -} pub struct App { saved_settings: Settings, @@ -330,9 +327,9 @@ impl App { continue; } - if let Some(extension) = path.extension().and_then(|n| n.to_str()) { - if music_extensions.contains(&extension.to_lowercase().as_str()) { - if path + if let Some(extension) = path.extension().and_then(|n| n.to_str()) + && music_extensions.contains(&extension.to_lowercase().as_str()) + && path .to_str() .unwrap() .to_string() @@ -341,8 +338,6 @@ impl App { { music_files.push(path); } - } - } } ui.vertical(|ui| { let search_entry = TextEdit::singleline(&mut self.search_query); diff --git a/src/app/pw.rs b/src/app/pw.rs index 6359711..042653e 100644 --- a/src/app/pw.rs +++ b/src/app/pw.rs @@ -53,7 +53,7 @@ impl OutputDevice { fn get_pw_entries() -> Result>, Box> { let output = Command::new("pw-cli") - .args(&["ls", "Node"]) + .args(["ls", "Node"]) .output() .expect("Failed to execute pw-cli ls Node"); @@ -123,7 +123,7 @@ pub fn get_input_devices() -> Result, Box> { continue; } - if !media_class.starts_with(&"Audio/Source") { + if !media_class.starts_with("Audio/Source") { continue; } @@ -191,7 +191,7 @@ pub fn get_output_devices() -> Result, Box> { continue; } - if !media_class.starts_with(&"Stream/Output/Audio") { + if !media_class.starts_with("Stream/Output/Audio") { continue; }