@@ -2194,7 +2194,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21942194 fn suggest_associated_call_syntax (
21952195 & self ,
21962196 err : & mut Diag < ' _ > ,
2197- static_candidates : & Vec < CandidateSource > ,
2197+ static_candidates : & [ CandidateSource ] ,
21982198 rcvr_ty : Ty < ' tcx > ,
21992199 source : SelfSource < ' tcx > ,
22002200 item_name : Ident ,
@@ -2422,7 +2422,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24222422
24232423 let span_included = match parent_expr. kind {
24242424 hir:: ExprKind :: Struct ( _, eps, _) => {
2425- eps. len ( ) > 0 && eps . last ( ) . is_some_and ( |ep| ep. span . contains ( span) )
2425+ eps. last ( ) . is_some_and ( |ep| ep. span . contains ( span) )
24262426 }
24272427 // `..=` desugars into `::std::ops::RangeInclusive::new(...)`.
24282428 hir:: ExprKind :: Call ( func, ..) => func. span . contains ( span) ,
@@ -2484,7 +2484,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24842484 simplify_type ( tcx, ty, TreatParams :: InstantiateWithInfer )
24852485 . and_then ( |simp| {
24862486 tcx. incoherent_impls ( simp)
2487- . into_iter ( )
2487+ . iter ( )
24882488 . find_map ( |& id| self . associated_value ( id, item_name) )
24892489 } )
24902490 . is_some ( )
@@ -2617,7 +2617,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
26172617
26182618 if let Node :: Expr ( call_expr) = self . tcx . parent_hir_node ( seg1. hir_id )
26192619 && let ControlFlow :: Break ( Some ( expr) ) =
2620- ( LetVisitor { ident_name : seg1. ident . name } ) . visit_body ( & body)
2620+ ( LetVisitor { ident_name : seg1. ident . name } ) . visit_body ( body)
26212621 && let Some ( self_ty) = self . node_ty_opt ( expr. hir_id )
26222622 {
26232623 let probe = self . lookup_probe_for_diagnostic (
@@ -2960,14 +2960,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
29602960 . collect :: < Vec < _ > > ( )
29612961 . into ( ) ;
29622962 for pred in & local_preds {
2963- match pred. self_ty ( ) . kind ( ) {
2964- ty:: Adt ( def, _) => {
2965- local_spans. push_span_label (
2966- self . tcx . def_span ( def. did ( ) ) ,
2967- format ! ( "must implement `{}`" , pred. trait_ref. print_trait_sugared( ) ) ,
2968- ) ;
2969- }
2970- _ => { }
2963+ if let ty:: Adt ( def, _) = pred. self_ty ( ) . kind ( ) {
2964+ local_spans. push_span_label (
2965+ self . tcx . def_span ( def. did ( ) ) ,
2966+ format ! ( "must implement `{}`" , pred. trait_ref. print_trait_sugared( ) ) ,
2967+ ) ;
29712968 }
29722969 }
29732970 if local_spans. primary_span ( ) . is_some ( ) {
@@ -3006,14 +3003,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
30063003 . collect :: < Vec < _ > > ( )
30073004 . into ( ) ;
30083005 for pred in & foreign_preds {
3009- match pred. self_ty ( ) . kind ( ) {
3010- ty:: Adt ( def, _) => {
3011- foreign_spans. push_span_label (
3012- self . tcx . def_span ( def. did ( ) ) ,
3013- format ! ( "not implement `{}`" , pred. trait_ref. print_trait_sugared( ) ) ,
3014- ) ;
3015- }
3016- _ => { }
3006+ if let ty:: Adt ( def, _) = pred. self_ty ( ) . kind ( ) {
3007+ foreign_spans. push_span_label (
3008+ self . tcx . def_span ( def. did ( ) ) ,
3009+ format ! ( "not implement `{}`" , pred. trait_ref. print_trait_sugared( ) ) ,
3010+ ) ;
30173011 }
30183012 }
30193013 if foreign_spans. primary_span ( ) . is_some ( ) {
@@ -3595,7 +3589,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
35953589 // would take care of them.
35963590 && !skippable. contains ( & Some ( pick. item . container_id ( self . tcx ) ) )
35973591 // Do not suggest pinning when the method is directly on `Pin`.
3598- && pick. item . impl_container ( self . tcx ) . map_or ( true , |did| {
3592+ && pick. item . impl_container ( self . tcx ) . is_none_or ( |did| {
35993593 match self . tcx . type_of ( did) . skip_binder ( ) . kind ( ) {
36003594 ty:: Adt ( def, _) => Some ( def. did ( ) ) != self . tcx . lang_items ( ) . pin_type ( ) ,
36013595 _ => true ,
@@ -3653,7 +3647,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
36533647 vec ! [
36543648 (
36553649 rcvr. span. shrink_to_lo( ) ,
3656- format! ( "let mut pinned = std::pin::pin!(" ) ,
3650+ "let mut pinned = std::pin::pin!(" . to_string ( ) ,
36573651 ) ,
36583652 (
36593653 rcvr. span. shrink_to_hi( ) ,
@@ -4128,7 +4122,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
41284122 ) ;
41294123 let trait_span = self . tcx . def_span ( trait_def_id) ;
41304124 let mut multi_span: MultiSpan = trait_span. into ( ) ;
4131- multi_span. push_span_label ( trait_span, format ! ( "this is the trait that is needed" ) ) ;
4125+ multi_span. push_span_label ( trait_span, "this is the trait that is needed" . to_string ( ) ) ;
41324126 let descr = self . tcx . associated_item ( item_def_id) . descr ( ) ;
41334127 let rcvr_ty =
41344128 rcvr_ty. map ( |t| format ! ( "`{t}`" ) ) . unwrap_or_else ( || "the receiver" . to_string ( ) ) ;
@@ -4146,7 +4140,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
41464140 }
41474141 multi_span. push_span_label (
41484142 self . tcx . def_span ( def_id) ,
4149- format ! ( "this is the trait that was imported" ) ,
4143+ "this is the trait that was imported" . to_string ( ) ,
41504144 ) ;
41514145 }
41524146 err. span_note ( multi_span, msg) ;
0 commit comments