mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
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
This commit is contained in:
parent
ca51f4f6c0
commit
fb021d7cef
21 changed files with 179 additions and 141 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue