@@ -978,7 +978,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
978
978
let ( _, sig, reg) = ty:: print:: FmtPrinter :: new ( self . tcx , Namespace :: TypeNS )
979
979
. name_all_regions ( sig)
980
980
. unwrap ( ) ;
981
- let lts: Vec < String > = reg. into_iter ( ) . map ( |( _ , kind) | kind. to_string ( ) ) . collect ( ) ;
981
+ let lts: Vec < String > = reg. into_values ( ) . map ( |kind| kind. to_string ( ) ) . collect ( ) ;
982
982
( if lts. is_empty ( ) { String :: new ( ) } else { format ! ( "for<{}> " , lts. join( ", " ) ) } , sig)
983
983
} ;
984
984
@@ -2399,10 +2399,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
2399
2399
let suggestion =
2400
2400
if has_lifetimes { format ! ( " + {}" , sub) } else { format ! ( ": {}" , sub) } ;
2401
2401
let mut suggestions = vec ! [ ( sp, suggestion) ] ;
2402
- for add_lt_sugg in add_lt_suggs {
2403
- if let Some ( add_lt_sugg) = add_lt_sugg {
2404
- suggestions. push ( add_lt_sugg) ;
2405
- }
2402
+ for add_lt_sugg in add_lt_suggs. into_iter ( ) . flatten ( ) {
2403
+ suggestions. push ( add_lt_sugg) ;
2406
2404
}
2407
2405
err. multipart_suggestion_verbose (
2408
2406
format ! ( "{msg}..." ) ,
@@ -2426,11 +2424,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
2426
2424
} ;
2427
2425
let mut sugg =
2428
2426
vec ! [ ( sp, suggestion) , ( span. shrink_to_hi( ) , format!( " + {}" , new_lt) ) ] ;
2429
- for add_lt_sugg in add_lt_suggs. clone ( ) {
2430
- if let Some ( lt) = add_lt_sugg {
2431
- sugg. push ( lt) ;
2432
- sugg. rotate_right ( 1 ) ;
2433
- }
2427
+ for lt in add_lt_suggs. clone ( ) . into_iter ( ) . flatten ( ) {
2428
+ sugg. push ( lt) ;
2429
+ sugg. rotate_right ( 1 ) ;
2434
2430
}
2435
2431
// `MaybeIncorrect` due to issue #41966.
2436
2432
err. multipart_suggestion ( msg, sugg, Applicability :: MaybeIncorrect ) ;
0 commit comments