Skip to content

Commit e0559e3

Browse files
More idiomatic match statement
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
1 parent 3a835f9 commit e0559e3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/uu/ls/src/ls.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,10 +3418,7 @@ fn get_security_context<'a>(
34183418
// For SMACK, use the path to get the label
34193419
// If must_dereference is true, we follow the symlink
34203420
let target_path = if must_dereference {
3421-
match std::fs::canonicalize(path) {
3422-
Ok(p) => p,
3423-
Err(_) => path.to_path_buf(),
3424-
}
3421+
std::fs::canonicalize(path).unwrap_or_else(|_| path.to_path_buf())
34253422
} else {
34263423
path.to_path_buf()
34273424
};

0 commit comments

Comments
 (0)