@@ -2194,7 +2194,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2194
2194
fn suggest_associated_call_syntax (
2195
2195
& self ,
2196
2196
err : & mut Diag < ' _ > ,
2197
- static_candidates : & Vec < CandidateSource > ,
2197
+ static_candidates : & [ CandidateSource ] ,
2198
2198
rcvr_ty : Ty < ' tcx > ,
2199
2199
source : SelfSource < ' tcx > ,
2200
2200
item_name : Ident ,
@@ -2422,7 +2422,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2422
2422
2423
2423
let span_included = match parent_expr. kind {
2424
2424
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) )
2426
2426
}
2427
2427
// `..=` desugars into `::std::ops::RangeInclusive::new(...)`.
2428
2428
hir:: ExprKind :: Call ( func, ..) => func. span . contains ( span) ,
@@ -2484,7 +2484,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2484
2484
simplify_type ( tcx, ty, TreatParams :: InstantiateWithInfer )
2485
2485
. and_then ( |simp| {
2486
2486
tcx. incoherent_impls ( simp)
2487
- . into_iter ( )
2487
+ . iter ( )
2488
2488
. find_map ( |& id| self . associated_value ( id, item_name) )
2489
2489
} )
2490
2490
. is_some ( )
@@ -2617,7 +2617,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2617
2617
2618
2618
if let Node :: Expr ( call_expr) = self . tcx . parent_hir_node ( seg1. hir_id )
2619
2619
&& 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)
2621
2621
&& let Some ( self_ty) = self . node_ty_opt ( expr. hir_id )
2622
2622
{
2623
2623
let probe = self . lookup_probe_for_diagnostic (
@@ -2960,14 +2960,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2960
2960
. collect :: < Vec < _ > > ( )
2961
2961
. into ( ) ;
2962
2962
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
+ ) ;
2971
2968
}
2972
2969
}
2973
2970
if local_spans. primary_span ( ) . is_some ( ) {
@@ -3006,14 +3003,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3006
3003
. collect :: < Vec < _ > > ( )
3007
3004
. into ( ) ;
3008
3005
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
+ ) ;
3017
3011
}
3018
3012
}
3019
3013
if foreign_spans. primary_span ( ) . is_some ( ) {
@@ -3595,7 +3589,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3595
3589
// would take care of them.
3596
3590
&& !skippable. contains ( & Some ( pick. item . container_id ( self . tcx ) ) )
3597
3591
// 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| {
3599
3593
match self . tcx . type_of ( did) . skip_binder ( ) . kind ( ) {
3600
3594
ty:: Adt ( def, _) => Some ( def. did ( ) ) != self . tcx . lang_items ( ) . pin_type ( ) ,
3601
3595
_ => true ,
@@ -3653,7 +3647,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3653
3647
vec ! [
3654
3648
(
3655
3649
rcvr. span. shrink_to_lo( ) ,
3656
- format! ( "let mut pinned = std::pin::pin!(" ) ,
3650
+ "let mut pinned = std::pin::pin!(" . to_string ( ) ,
3657
3651
) ,
3658
3652
(
3659
3653
rcvr. span. shrink_to_hi( ) ,
@@ -4128,7 +4122,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
4128
4122
) ;
4129
4123
let trait_span = self . tcx . def_span ( trait_def_id) ;
4130
4124
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 ( ) ) ;
4132
4126
let descr = self . tcx . associated_item ( item_def_id) . descr ( ) ;
4133
4127
let rcvr_ty =
4134
4128
rcvr_ty. map ( |t| format ! ( "`{t}`" ) ) . unwrap_or_else ( || "the receiver" . to_string ( ) ) ;
@@ -4146,7 +4140,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
4146
4140
}
4147
4141
multi_span. push_span_label (
4148
4142
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 ( ) ,
4150
4144
) ;
4151
4145
}
4152
4146
err. span_note ( multi_span, msg) ;
0 commit comments