@@ -291,10 +291,13 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
291291 && let Some ( ty) = use_node. defined_ty ( cx)
292292 && TyCoercionStability :: for_defined_ty ( cx, ty, use_node. is_return ( ) ) . is_deref_stable ( )
293293 {
294- self . state = Some ( ( State :: ExplicitDeref { mutability : None } , StateData {
295- first_expr : expr,
296- adjusted_ty,
297- } ) ) ;
294+ self . state = Some ( (
295+ State :: ExplicitDeref { mutability : None } ,
296+ StateData {
297+ first_expr : expr,
298+ adjusted_ty,
299+ } ,
300+ ) ) ;
298301 }
299302 } ,
300303 RefOp :: Method { mutbl, is_ufcs }
@@ -456,10 +459,13 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
456459 && next_adjust. is_none_or ( |a| matches ! ( a. kind, Adjust :: Deref ( _) | Adjust :: Borrow ( _) ) )
457460 && iter. all ( |a| matches ! ( a. kind, Adjust :: Deref ( _) | Adjust :: Borrow ( _) ) )
458461 {
459- self . state = Some ( ( State :: Borrow { mutability } , StateData {
460- first_expr : expr,
461- adjusted_ty,
462- } ) ) ;
462+ self . state = Some ( (
463+ State :: Borrow { mutability } ,
464+ StateData {
465+ first_expr : expr,
466+ adjusted_ty,
467+ } ,
468+ ) ) ;
463469 }
464470 } ,
465471 _ => { } ,
@@ -503,10 +509,13 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
503509 let stability = state. stability ;
504510 report ( cx, expr, State :: DerefedBorrow ( state) , data, typeck) ;
505511 if stability. is_deref_stable ( ) {
506- self . state = Some ( ( State :: Borrow { mutability } , StateData {
507- first_expr : expr,
508- adjusted_ty,
509- } ) ) ;
512+ self . state = Some ( (
513+ State :: Borrow { mutability } ,
514+ StateData {
515+ first_expr : expr,
516+ adjusted_ty,
517+ } ,
518+ ) ) ;
510519 }
511520 } ,
512521 ( Some ( ( State :: DerefedBorrow ( state) , data) ) , RefOp :: Deref ) => {
@@ -531,10 +540,13 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
531540 } else if stability. is_deref_stable ( )
532541 && let Some ( parent) = get_parent_expr ( cx, expr)
533542 {
534- self . state = Some ( ( State :: ExplicitDeref { mutability : None } , StateData {
535- first_expr : parent,
536- adjusted_ty,
537- } ) ) ;
543+ self . state = Some ( (
544+ State :: ExplicitDeref { mutability : None } ,
545+ StateData {
546+ first_expr : parent,
547+ adjusted_ty,
548+ } ,
549+ ) ) ;
538550 }
539551 } ,
540552
@@ -1124,17 +1136,20 @@ impl<'tcx> Dereferencing<'tcx> {
11241136 if let Some ( outer_pat) = self . ref_locals . get_mut ( & local) {
11251137 if let Some ( pat) = outer_pat {
11261138 // Check for auto-deref
1127- if !matches ! ( cx. typeck_results( ) . expr_adjustments( e) , [
1128- Adjustment {
1129- kind: Adjust :: Deref ( _) ,
1130- ..
1131- } ,
1132- Adjustment {
1133- kind: Adjust :: Deref ( _) ,
1139+ if !matches ! (
1140+ cx. typeck_results( ) . expr_adjustments( e) ,
1141+ [
1142+ Adjustment {
1143+ kind: Adjust :: Deref ( _) ,
1144+ ..
1145+ } ,
1146+ Adjustment {
1147+ kind: Adjust :: Deref ( _) ,
1148+ ..
1149+ } ,
11341150 ..
1135- } ,
1136- ..
1137- ] ) {
1151+ ]
1152+ ) {
11381153 match get_parent_expr ( cx, e) {
11391154 // Field accesses are the same no matter the number of references.
11401155 Some ( Expr {
0 commit comments