summaryrefslogtreecommitdiff
path: root/cli/util/fs.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-03-15 17:46:36 -0400
committerGitHub <noreply@github.com>2023-03-15 17:46:36 -0400
commitfb021d7ceff3f8b1d7cdb0c2bdd75ea07c0428d2 (patch)
tree09cb2bf87bba760b1abf706e0b8faedc9c368bbc /cli/util/fs.rs
parentca51f4f6c058d16ac438ad75ac92e8954895f5aa (diff)
refactor: remove usages of `map_or` / `map_or_else` (#18212)
These methods are confusing because the arguments are backwards. I feel like they should have never been added to `Option<T>` and that clippy should suggest rewriting to `map(...).unwrap_or(...)`/`map(...).unwrap_or_else(|| ...)` https://github.com/rust-lang/rfcs/issues/1025
Diffstat (limited to 'cli/util/fs.rs')
-rw-r--r--cli/util/fs.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/util/fs.rs b/cli/util/fs.rs
index 4ac57eac0..8167fd2e5 100644
--- a/cli/util/fs.rs
+++ b/cli/util/fs.rs
@@ -732,7 +732,8 @@ mod tests {
path
.file_name()
.and_then(|f| f.to_str())
- .map_or(false, |f| !f.starts_with('.'))
+ .map(|f| !f.starts_with('.'))
+ .unwrap_or(false)
})
.add_ignore_paths(&[ignore_dir_path]);
@@ -847,7 +848,8 @@ mod tests {
path
.file_name()
.and_then(|f| f.to_str())
- .map_or(false, |f| !f.starts_with('.'))
+ .map(|f| !f.starts_with('.'))
+ .unwrap_or(false)
};
let result = collect_specifiers(