Skip to content

Commit

Permalink
fix lint by removing unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Mar 12, 2024
1 parent 1435c3d commit d03934f
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::{Error, TrashContext, TrashItem, TrashItemMetadata, TrashItemSize};
use std::{
borrow::Borrow,
ffi::{c_void, OsStr, OsString},
fs, io,
os::windows::{ffi::OsStrExt, prelude::*},
path::PathBuf,
};
Expand Down Expand Up @@ -304,36 +303,3 @@ thread_local! {
fn ensure_com_initialized() {
CO_INITIALIZER.with(|_| {});
}

fn traverse_paths_recursively(
paths: impl IntoIterator<Item = PathBuf>,
collection: &mut Vec<PathBuf>,
) -> Result<(), Error> {
for base_path in paths {
if base_path.is_file() || base_path.is_symlink() {
collection.push(base_path);
continue;
}

let entries = match fs::read_dir(&base_path) {
Ok(entries) => entries,
Err(err) => {
let err = match err.kind() {
io::ErrorKind::NotFound | io::ErrorKind::PermissionDenied => {
Error::CouldNotAccess { target: base_path.to_string_lossy().to_string() }
}
_ => Error::Unknown { description: err.to_string() },
};

return Err(err);
}
};

for entry in entries {
let entry = entry.map_err(|err| Error::Unknown { description: err.to_string() })?;
traverse_paths_recursively(Some(entry.path()), collection)?;
}
collection.push(base_path);
}
Ok(())
}

0 comments on commit d03934f

Please sign in to comment.