From 2de9ea706f5d64d681ae46d5892bedfdb7ff6eb8 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 30 Sep 2021 02:06:26 -0400 Subject: [PATCH] Resolve map_unwrap_or pedantic clippy lint error: called `map().unwrap_or()` on an `Option` value. This can be done more directly by calling `map_or(, )` instead --> tests/repo/mod.rs:73:8 | 73 | if path.extension().map(|e| e != "rs").unwrap_or(true) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::map-unwrap-or` implied by `-D clippy::pedantic` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or help: use `map_or(, )` instead | 73 - if path.extension().map(|e| e != "rs").unwrap_or(true) { 73 + if path.extension().map_or(true, |e| e != "rs") { | --- tests/repo/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/repo/mod.rs b/tests/repo/mod.rs index 8d7678a0b3..240df97f29 100644 --- a/tests/repo/mod.rs +++ b/tests/repo/mod.rs @@ -1,4 +1,4 @@ -#![allow(clippy::if_then_panic, clippy::map_unwrap_or)] +#![allow(clippy::if_then_panic)] mod progress; @@ -70,7 +70,7 @@ pub fn base_dir_filter(entry: &DirEntry) -> bool { if path.is_dir() { return true; // otherwise walkdir does not visit the files } - if path.extension().map(|e| e != "rs").unwrap_or(true) { + if path.extension().map_or(true, |e| e != "rs") { return false; }