From 00a14f78355f74d5754bf8e66374ec17932a571c Mon Sep 17 00:00:00 2001 From: Evy Garden Date: Tue, 17 Oct 2023 21:22:18 +0200 Subject: [PATCH] cargo fmt --- src/freedesktop.rs | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/freedesktop.rs b/src/freedesktop.rs index 1031d3f..c4c994a 100644 --- a/src/freedesktop.rs +++ b/src/freedesktop.rs @@ -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);