a couple clippy::complexity fixes
map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference
This commit is contained in:
parent
0196c2bd27
commit
8ef3bf29fe
10 changed files with 20 additions and 33 deletions
|
@ -2399,10 +2399,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
let suggestion =
|
||||
if has_lifetimes { format!(" + {}", sub) } else { format!(": {}", sub) };
|
||||
let mut suggestions = vec![(sp, suggestion)];
|
||||
for add_lt_sugg in add_lt_suggs {
|
||||
if let Some(add_lt_sugg) = add_lt_sugg {
|
||||
suggestions.push(add_lt_sugg);
|
||||
}
|
||||
for add_lt_sugg in add_lt_suggs.into_iter().flatten() {
|
||||
suggestions.push(add_lt_sugg);
|
||||
}
|
||||
err.multipart_suggestion_verbose(
|
||||
format!("{msg}..."),
|
||||
|
@ -2426,11 +2424,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
};
|
||||
let mut sugg =
|
||||
vec![(sp, suggestion), (span.shrink_to_hi(), format!(" + {}", new_lt))];
|
||||
for add_lt_sugg in add_lt_suggs.clone() {
|
||||
if let Some(lt) = add_lt_sugg {
|
||||
sugg.push(lt);
|
||||
sugg.rotate_right(1);
|
||||
}
|
||||
for lt in add_lt_suggs.clone().into_iter().flatten() {
|
||||
sugg.push(lt);
|
||||
sugg.rotate_right(1);
|
||||
}
|
||||
// `MaybeIncorrect` due to issue #41966.
|
||||
err.multipart_suggestion(msg, sugg, Applicability::MaybeIncorrect);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue