@@ -978,7 +978,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
978978 let ( _, sig, reg) = ty:: print:: FmtPrinter :: new ( self . tcx , Namespace :: TypeNS )
979979 . name_all_regions ( sig)
980980 . 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 ( ) ;
982982 ( if lts. is_empty ( ) { String :: new ( ) } else { format ! ( "for<{}> " , lts. join( ", " ) ) } , sig)
983983 } ;
984984
@@ -2399,10 +2399,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
23992399 let suggestion =
24002400 if has_lifetimes { format ! ( " + {}" , sub) } else { format ! ( ": {}" , sub) } ;
24012401 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) ;
24062404 }
24072405 err. multipart_suggestion_verbose (
24082406 format ! ( "{msg}..." ) ,
@@ -2426,11 +2424,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
24262424 } ;
24272425 let mut sugg =
24282426 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 ) ;
24342430 }
24352431 // `MaybeIncorrect` due to issue #41966.
24362432 err. multipart_suggestion ( msg, sugg, Applicability :: MaybeIncorrect ) ;
0 commit comments