diff options
author | David Peter <mail@david-peter.de> | 2021-11-14 09:44:40 +0100 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2021-11-14 09:51:41 +0100 |
commit | 14c9b1a7487266c4395cef1bfa1d5caab387fd01 (patch) | |
tree | d82cc96076059a278a7ac80ce4352c5ac723120d | |
parent | f146a3f5ca24ad2c66147b5ec05dd1b37480159b (diff) |
Fix clippy warnings
-rw-r--r-- | src/walk.rs | 6 | ||||
-rw-r--r-- | tests/walk.rs | 5 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/walk.rs b/src/walk.rs index 64ea982..15a4aa5 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -33,10 +33,8 @@ fn walk(tx: channel::Sender<Message>, entries: &[PathBuf], filesize_type: Filesi let mut children = vec![]; match fs::read_dir(entry) { Ok(child_entries) => { - for child_entry in child_entries { - if let Ok(child_entry) = child_entry { - children.push(child_entry.path()); - } + for child_entry in child_entries.flatten() { + children.push(child_entry.path()); } } Err(_) => { diff --git a/tests/walk.rs b/tests/walk.rs index 6e1dd35..4fda407 100644 --- a/tests/walk.rs +++ b/tests/walk.rs @@ -1,7 +1,6 @@ use std::error::Error; use std::fs::File; use std::io::Write; -use std::path::PathBuf; use tempdir::TempDir; @@ -12,10 +11,10 @@ fn size_of_single_file() -> Result<(), Box<dyn Error>> { let tmp_dir = TempDir::new("diskus-tests")?; let file_path = tmp_dir.path().join("file-100-byte"); - File::create(&file_path)?.write(&vec![0u8; 100])?; + File::create(&file_path)?.write_all(&[0u8; 100])?; let num_threads = 1; - let root_directories = &[PathBuf::from(file_path)]; + let root_directories = &[file_path]; let walk = Walk::new(root_directories, num_threads, FilesizeType::ApparentSize); let (size_in_bytes, errors) = walk.run(); |