Rollup merge of #93634 - matthiaskrgr:clippy_complexity_jan_2022, r=oli-obk

compiler: clippy::complexity fixes

useless_format
map_flatten
useless_conversion
needless_bool
filter_next
clone_on_copy
needless_option_as_deref
This commit is contained in:
Matthias Krüger 2022-02-18 16:23:33 +01:00 committed by GitHub
commit a144ea1c4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 39 additions and 45 deletions

View file

@ -1362,8 +1362,7 @@ impl<'a> Resolver<'a> {
.filter(|(_, module)| {
current_module.is_ancestor_of(module) && !ptr::eq(current_module, *module)
})
.map(|(_, module)| module.kind.name())
.flatten(),
.flat_map(|(_, module)| module.kind.name()),
)
.filter(|c| !c.to_string().is_empty())
.collect::<Vec<_>>();
@ -1859,7 +1858,7 @@ crate fn show_candidates(
let instead = if instead { " instead" } else { "" };
let mut msg = format!("consider importing {} {}{}", determiner, kind, instead);
for note in accessible_path_strings.iter().map(|cand| cand.3.as_ref()).flatten() {
for note in accessible_path_strings.iter().flat_map(|cand| cand.3.as_ref()) {
err.note(note);
}
@ -1942,7 +1941,7 @@ crate fn show_candidates(
multi_span.push_span_label(span, format!("`{}`: not accessible", name));
}
for note in inaccessible_path_strings.iter().map(|cand| cand.3.as_ref()).flatten() {
for note in inaccessible_path_strings.iter().flat_map(|cand| cand.3.as_ref()) {
err.note(note);
}