We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd2e33b commit 19c7200Copy full SHA for 19c7200
src/uu/rm/src/rm.rs
@@ -373,10 +373,7 @@ pub fn remove(files: &[&OsStr], options: &Options) -> bool {
373
/// `path` must be a directory. If there is an error reading the
374
/// contents of the directory, this returns `false`.
375
fn is_dir_empty(path: &Path) -> bool {
376
- match fs::read_dir(path) {
377
- Err(_) => false,
378
- Ok(iter) => iter.count() == 0,
379
- }
+ fs::read_dir(path).is_ok_and(|mut iter| iter.next().is_none())
380
}
381
382
#[cfg(unix)]
0 commit comments