Skip to content

Commit

Permalink
🐎 use and_then instead of map in unwrap_or_else
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune committed Nov 28, 2024
1 parent 496eb14 commit d2e8e8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/src/command/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ where
DataKind::SymbolicLink | DataKind::HardLink => {
let original = entry
.reader(ReadOptions::with_password(password))
.map(|r| io::read_to_string(r).unwrap_or_else(|_| "-".into()))
.unwrap_or_default();
.and_then(|r| io::read_to_string(r))

Check warning

Code scanning / clippy

redundant closure Warning

redundant closure

Check warning

Code scanning / clippy

redundant closure Warning

redundant closure
.unwrap_or_else(|_| "-".into());
format!("{} -> {}", header.path(), original)
}
DataKind::Directory if options.classify => format!("{}/", header.path()),
Expand Down

0 comments on commit d2e8e8e

Please sign in to comment.