refactor: simplify iterator to get size

This commit is contained in:
Valentin Bersier
2023-01-18 08:00:53 +01:00
parent df3bea3d4f
commit 8c76c6a3c8

View File

@@ -151,8 +151,7 @@ pub fn print(duplicates: DashMap<String, Vec<File>>, opts: &Params) {
// we extract the file size of the first file in the group
let size =
f.1.first()
.and_then(|ff| Some(&ff.path))
.and_then(|p| fs::metadata(p).ok())
.and_then(|ff| fs::metadata(&ff.path).ok())
.and_then(|m| Some(m.len()));
(f.0, f.1, size)
})