Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
EvysGarden committed Oct 17, 2023
1 parent fdde5bf commit 00a14f7
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/freedesktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,25 @@ impl TrashContext {
debug!("The home topdir is {:?}", home_topdir);
let uid = unsafe { libc::getuid() };

full_paths
.iter()
.try_for_each(|path| {
let topdir = get_topdir_for_path(path, &mount_points);

if topdir == home_topdir {
if path.starts_with(home_trash.as_path()) {
return Err(Error::TargetedTrash);
}
} else {
return execute_on_mounted_trash_folders(uid, topdir, true, true, |trash_path| {
if path.starts_with(trash_path.as_path()) {
Err(Error::TargetedTrash)
} else {
Ok(())
}
});
full_paths.iter().try_for_each(|path| {
let topdir = get_topdir_for_path(path, &mount_points);

if topdir == home_topdir {
if path.starts_with(home_trash.as_path()) {
return Err(Error::TargetedTrash);
}
} else {
return execute_on_mounted_trash_folders(uid, topdir, true, true, |trash_path| {
if path.starts_with(trash_path.as_path()) {
Err(Error::TargetedTrash)
} else {
Ok(())
}
});
}

Ok(())
})?;
Ok(())
})?;

for path in full_paths {
debug!("Deleting {:?}", path);
Expand Down

0 comments on commit 00a14f7

Please sign in to comment.