Fix clippy::map_unwrap_or (pedantic)

https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2022-11-21 18:11:01 -08:00 committed by Charlie Marsh
parent bc95690725
commit 3b33a431d6
8 changed files with 23 additions and 38 deletions

View file

@ -121,10 +121,9 @@ pub fn match_call_path(
// `Match`).
if num_segments == 0 {
module.is_empty()
|| from_imports
.get(module)
.map(|imports| imports.contains(member) || imports.contains("*"))
.unwrap_or(false)
|| from_imports.get(module).map_or(false, |imports| {
imports.contains(member) || imports.contains("*")
})
} else {
let components: Vec<&str> = module.split('.').collect();
@ -148,8 +147,7 @@ pub fn match_call_path(
let member = components[cut];
if from_imports
.get(&module.as_str())
.map(|imports| imports.contains(member))
.unwrap_or(false)
.map_or(false, |imports| imports.contains(member))
{
return true;
}