about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2021-09-21 23:55:00 +0200
committerMel <einebeere@gmail.com>2021-09-21 23:55:00 +0200
commitc96b464bed616d40f1204136c0c5a739fe6fe7ba (patch)
tree3d896f1a0b0b26434421ab2b7b93c9bc01abe06d
parent2890afd3e45779b04681f0b26e0fc93e4133cd42 (diff)
downloadka-c96b464bed616d40f1204136c0c5a739fe6fe7ba.tar.zst
ka-c96b464bed616d40f1204136c0c5a739fe6fe7ba.zip
Fix clippy complaints
-rw-r--r--src/files.rs10
-rw-r--r--src/history.rs2
2 files changed, 5 insertions, 7 deletions
diff --git a/src/files.rs b/src/files.rs
index 3b6e9cb..41dbad1 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -26,12 +26,12 @@ impl Locations {
             fs::read_dir(&self.ka_files_path).context("Failed reading history file entries.")?;
 
         let working_files = Self::walk_directory(working_entries, &|entry| {
-            FileState::from_working(&self, &entry.path()).ok()
+            FileState::from_working(self, &entry.path()).ok()
         })?;
 
         let deleted_files = Self::walk_directory(history_entries, &|entry| {
             let file_path = entry.path();
-            let file = FileState::from_history(&self, &file_path).ok()?;
+            let file = FileState::from_history(self, &file_path).ok()?;
             match file {
                 FileState::Deleted { .. } => Some(file),
                 FileState::Tracked { .. } => None,
@@ -68,10 +68,8 @@ impl Locations {
                 let nested_directory = fs::read_dir(entry.path())?;
                 let nested_files = Self::walk_directory(nested_directory, filter_map)?;
                 entries.extend(nested_files);
-            } else {
-                if let Some(states) = filter_map(entry) {
-                    entries.push(states);
-                }
+            } else if let Some(states) = filter_map(entry) {
+                entries.push(states);
             }
         }
 
diff --git a/src/history.rs b/src/history.rs
index ce5ae26..3f5e43f 100644
--- a/src/history.rs
+++ b/src/history.rs
@@ -22,7 +22,7 @@ impl FileHistory {
             .context("Failed reading file history.")?;
 
         let file_history = serde_json::from_slice::<FileHistory>(&buffer);
-        Ok(file_history.context("Corrupted file history.")?)
+        file_history.context("Corrupted file history.")
     }
 
     pub fn write_to_file(&self, file: &mut File) -> anyhow::Result<()> {