From 8c3c8efa428200c67c1a6fa731faee55adf19678 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Thu, 6 Jul 2023 14:05:39 +0200 Subject: cleanup with clippy --- src/index.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/index.rs') diff --git a/src/index.rs b/src/index.rs index 4fabe32..8c358d3 100644 --- a/src/index.rs +++ b/src/index.rs @@ -52,8 +52,8 @@ impl Index { entry.path() .to_str() .unwrap() - .replace(",", "\0"), - fv.to_string() + .replace(',', "\0"), + fv.stringify() ).ok(); filecache.push(FileCache { @@ -95,8 +95,8 @@ impl Index { for line in reader.lines() { let l = line.unwrap(); - if l.starts_with("#") { - dict = Dictionary::from_line(&l.strip_prefix("#").unwrap()); + if l.starts_with('#') { + dict = Dictionary::from_line(l.strip_prefix('#').unwrap()); } else { filecache.push(FileCache::from_line(l)); } @@ -112,9 +112,8 @@ impl Index { let mut v : FileVector = FileVector::new(); for arg in search_args { - match self.dictionary.get(arg.to_string()) { - Some(value) => { v.insert(*value, 1); } - None => {} + if let Some(value) = self.dictionary.get(arg.to_string()) { + v.insert(*value, 1); } } -- cgit v1.2.3-70-g09d2