Explorar o código

chore: avoid `unwrap()` by changing filter-then-map to `filter_map`

andoalon %!s(int64=2) %!d(string=hai) anos
pai
achega
b8355a1c47
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  1. 1 2
      src/main.rs

+ 1 - 2
src/main.rs

@@ -204,8 +204,7 @@ fn get_files_in_dir(paths: &mut Vec<PathBuf>, path: PathBuf) {
                 vec![path]
             }
             Ok(d) => d
-                .filter(std::result::Result::is_ok)
-                .map(|entry| entry.unwrap().path())
+                .filter_map(|entry| entry.ok().map(|e| e.path()))
                 .collect::<Vec<PathBuf>>(),
         }
     } else {