From b29846fb72326dc04bc13fe11d07965879787533 Mon Sep 17 00:00:00 2001 From: krolxon Date: Wed, 1 May 2024 00:06:50 +0530 Subject: abide by the lord clippy --- src/browser.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/browser.rs') diff --git a/src/browser.rs b/src/browser.rs index 08b0006..99c3ce8 100755 --- a/src/browser.rs +++ b/src/browser.rs @@ -23,7 +23,7 @@ pub trait FileExtension { impl> FileExtension for P { fn has_extension>(&self, extensions: &[S]) -> bool { - if let Some(ref extension) = self.as_ref().extension().and_then(OsStr::to_str) { + if let Some(extension) = self.as_ref().extension().and_then(OsStr::to_str) { return extensions .iter() .any(|x| x.as_ref().eq_ignore_ascii_case(extension)); @@ -84,7 +84,7 @@ impl FileBrowser { }] }); - self.songs.push(v.get(0).unwrap().clone()); + self.songs.push(v.first().unwrap().clone()); } else { let v = Song { file: "".to_string(), @@ -126,7 +126,7 @@ impl FileBrowser { /// handles going back event pub fn handle_go_back(&mut self, conn: &mut Connection) -> AppResult<()> { if self.prev_path != "." { - let r = self.path.rfind("/").unwrap(); + let r = self.path.rfind('/').unwrap(); self.path = self.path.as_str()[..r].to_string(); self.update_directory(conn)?; } else { @@ -138,3 +138,11 @@ impl FileBrowser { Ok(()) } } + + + +impl Default for FileBrowser { + fn default() -> Self { + Self::new() + } +} -- cgit v1.2.3