@@ -6,6 +6,7 @@ use clippy_utils::{binop_traits, eq_expr_value, trait_ref_of_method};
66use core:: ops:: ControlFlow ;
77use rustc_errors:: Applicability ;
88use rustc_hir as hir;
9+ use rustc_hir:: { HirId , HirIdSet } ;
910use rustc_hir_typeck:: expr_use_visitor:: { Delegate , ExprUseVisitor , PlaceBase , PlaceWithHirId } ;
1011use rustc_lint:: LateContext ;
1112use rustc_middle:: mir:: FakeReadCause ;
@@ -98,10 +99,10 @@ pub(super) fn check<'tcx>(
9899 }
99100}
100101
101- fn imm_borrows_in_expr ( cx : & LateContext < ' _ > , e : & hir:: Expr < ' _ > ) -> hir :: HirIdSet {
102- struct S ( hir :: HirIdSet ) ;
102+ fn imm_borrows_in_expr ( cx : & LateContext < ' _ > , e : & hir:: Expr < ' _ > ) -> HirIdSet {
103+ struct S ( HirIdSet ) ;
103104 impl Delegate < ' _ > for S {
104- fn borrow ( & mut self , place : & PlaceWithHirId < ' _ > , _: hir :: HirId , kind : BorrowKind ) {
105+ fn borrow ( & mut self , place : & PlaceWithHirId < ' _ > , _: HirId , kind : BorrowKind ) {
105106 if matches ! ( kind, BorrowKind :: ImmBorrow | BorrowKind :: UniqueImmBorrow ) {
106107 self . 0 . insert ( match place. place . base {
107108 PlaceBase :: Local ( id) => id,
@@ -111,13 +112,13 @@ fn imm_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> hir::HirIdSet
111112 }
112113 }
113114
114- fn consume ( & mut self , _: & PlaceWithHirId < ' _ > , _: hir :: HirId ) { }
115- fn mutate ( & mut self , _: & PlaceWithHirId < ' _ > , _: hir :: HirId ) { }
116- fn fake_read ( & mut self , _: & PlaceWithHirId < ' _ > , _: FakeReadCause , _: hir :: HirId ) { }
117- fn copy ( & mut self , _: & PlaceWithHirId < ' _ > , _: hir :: HirId ) { }
115+ fn consume ( & mut self , _: & PlaceWithHirId < ' _ > , _: HirId ) { }
116+ fn mutate ( & mut self , _: & PlaceWithHirId < ' _ > , _: HirId ) { }
117+ fn fake_read ( & mut self , _: & PlaceWithHirId < ' _ > , _: FakeReadCause , _: HirId ) { }
118+ fn copy ( & mut self , _: & PlaceWithHirId < ' _ > , _: HirId ) { }
118119 }
119120
120- let mut s = S ( hir :: HirIdSet :: default ( ) ) ;
121+ let mut s = S ( HirIdSet :: default ( ) ) ;
121122 let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
122123 let mut v = ExprUseVisitor :: new (
123124 & mut s,
@@ -130,10 +131,10 @@ fn imm_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> hir::HirIdSet
130131 s. 0
131132}
132133
133- fn mut_borrows_in_expr ( cx : & LateContext < ' _ > , e : & hir:: Expr < ' _ > ) -> hir :: HirIdSet {
134- struct S ( hir :: HirIdSet ) ;
134+ fn mut_borrows_in_expr ( cx : & LateContext < ' _ > , e : & hir:: Expr < ' _ > ) -> HirIdSet {
135+ struct S ( HirIdSet ) ;
135136 impl Delegate < ' _ > for S {
136- fn borrow ( & mut self , place : & PlaceWithHirId < ' _ > , _: hir :: HirId , kind : BorrowKind ) {
137+ fn borrow ( & mut self , place : & PlaceWithHirId < ' _ > , _: HirId , kind : BorrowKind ) {
137138 if matches ! ( kind, BorrowKind :: MutBorrow ) {
138139 self . 0 . insert ( match place. place . base {
139140 PlaceBase :: Local ( id) => id,
@@ -143,13 +144,13 @@ fn mut_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> hir::HirIdSet
143144 }
144145 }
145146
146- fn consume ( & mut self , _: & PlaceWithHirId < ' _ > , _: hir :: HirId ) { }
147- fn mutate ( & mut self , _: & PlaceWithHirId < ' _ > , _: hir :: HirId ) { }
148- fn fake_read ( & mut self , _: & PlaceWithHirId < ' _ > , _: FakeReadCause , _: hir :: HirId ) { }
149- fn copy ( & mut self , _: & PlaceWithHirId < ' _ > , _: hir :: HirId ) { }
147+ fn consume ( & mut self , _: & PlaceWithHirId < ' _ > , _: HirId ) { }
148+ fn mutate ( & mut self , _: & PlaceWithHirId < ' _ > , _: HirId ) { }
149+ fn fake_read ( & mut self , _: & PlaceWithHirId < ' _ > , _: FakeReadCause , _: HirId ) { }
150+ fn copy ( & mut self , _: & PlaceWithHirId < ' _ > , _: HirId ) { }
150151 }
151152
152- let mut s = S ( hir :: HirIdSet :: default ( ) ) ;
153+ let mut s = S ( HirIdSet :: default ( ) ) ;
153154 let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
154155 let mut v = ExprUseVisitor :: new (
155156 & mut s,
0 commit comments