Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed May 6, 2022
1 parent e5dc62e commit 220a216
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/freedesktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,39 +117,36 @@ pub fn list() -> Result<Vec<TrashItem>, Error> {
}
};
'trash_item: for entry in read_dir {
let info_entry;
match entry {
Ok(entry) => info_entry = entry,
let info_entry = match entry {
Ok(entry) => entry,
Err(e) => {
// Another thread or process may have removed that entry by now
debug!("Tried resolving the trash info `DirEntry` but it failed with: '{}'", e);
continue;
}
}
// Entrt should really be an info file but better safe than sorry
let file_type;
match info_entry.file_type() {
Ok(f_type) => file_type = f_type,
};
// Entrty should really be an info file but better safe than sorry
let file_type = match info_entry.file_type() {
Ok(f_type) => f_type,
Err(e) => {
// Another thread or process may have removed that entry by now
debug!("Tried getting the file type of the trash info `DirEntry` but failed with: {}", e);
continue;
}
}
};
let info_path = info_entry.path();
if !file_type.is_file() {
warn!("Found an item that's not a file, among the trash info files. This is unexpected. The path to the item is: '{:?}'", info_path);
continue;
}
let info_file;
match File::open(&info_path) {
Ok(file) => info_file = file,
let info_file = match File::open(&info_path) {
Ok(file) => file,
Err(e) => {
// Another thread or process may have removed that entry by now
debug!("Tried opening the trash info '{:?}' but failed with: {}", info_path, e);
continue;
}
}
};
let id = info_path.clone().into();
let mut name = None;
let mut original_parent: Option<PathBuf> = None;
Expand Down

0 comments on commit 220a216

Please sign in to comment.