Further simplify the code

This commit is contained in:
sharkdp 2020-02-28 13:10:52 +01:00 committed by David Peter
parent 8cea65c1b8
commit 82e6562cfc

View file

@ -61,12 +61,11 @@ impl TryFrom<WorkerResult> for PathBuf {
WorkerResult::Error(ignore_error) => { WorkerResult::Error(ignore_error) => {
if let ignore::Error::WithPath { path, err } = &ignore_error { if let ignore::Error::WithPath { path, err } = &ignore_error {
if let ignore::Error::Io(ref io_err) = **err { if let ignore::Error::Io(ref io_err) = **err {
if io_err.kind() == io::ErrorKind::NotFound { if io_err.kind() == io::ErrorKind::NotFound
if let Ok(metadata) = fs::symlink_metadata(&path) { && fs::symlink_metadata(&path)
if metadata.file_type().is_symlink() { .map_or(false, |m| m.file_type().is_symlink())
return Ok(path.to_path_buf()); {
} return Ok(path.to_path_buf());
}
} }
} }
} }