@@ -109,30 +109,43 @@ pub fn for_each_expr<'tcx, B, C: Continue>(
109109 res : Option < B > ,
110110 }
111111 impl < ' tcx , B , C : Continue , F : FnMut ( & ' tcx Expr < ' tcx > ) -> ControlFlow < B , C > > Visitor < ' tcx > for V < B , F > {
112- fn visit_expr ( & mut self , e : & ' tcx Expr < ' tcx > ) {
112+ type Result = ControlFlow < ( ) > ;
113+
114+ fn visit_expr ( & mut self , e : & ' tcx Expr < ' tcx > ) -> ControlFlow < ( ) > {
113115 if self . res . is_some ( ) {
114- return ;
116+ return ControlFlow :: Break ( ( ) ) ;
115117 }
116118 match ( self . f ) ( e) {
117119 ControlFlow :: Continue ( c) if c. descend ( ) => walk_expr ( self , e) ,
118- ControlFlow :: Break ( b) => self . res = Some ( b) ,
119- ControlFlow :: Continue ( _) => ( ) ,
120+ ControlFlow :: Break ( b) => {
121+ self . res = Some ( b) ;
122+ ControlFlow :: Break ( ( ) )
123+ } ,
124+ ControlFlow :: Continue ( _) => ControlFlow :: Continue ( ( ) ) ,
120125 }
121126 }
122127
123128 // Avoid unnecessary `walk_*` calls.
124- fn visit_ty ( & mut self , _: & ' tcx hir:: Ty < ' tcx > ) { }
125- fn visit_pat ( & mut self , _: & ' tcx Pat < ' tcx > ) { }
126- fn visit_qpath ( & mut self , _: & ' tcx QPath < ' tcx > , _: HirId , _: Span ) { }
129+ fn visit_ty ( & mut self , _: & ' tcx hir:: Ty < ' tcx > ) -> ControlFlow < ( ) > {
130+ ControlFlow :: Continue ( ( ) )
131+ }
132+ fn visit_pat ( & mut self , _: & ' tcx Pat < ' tcx > ) -> ControlFlow < ( ) > {
133+ ControlFlow :: Continue ( ( ) )
134+ }
135+ fn visit_qpath ( & mut self , _: & ' tcx QPath < ' tcx > , _: HirId , _: Span ) -> ControlFlow < ( ) > {
136+ ControlFlow :: Continue ( ( ) )
137+ }
127138 // Avoid monomorphising all `visit_*` functions.
128- fn visit_nested_item ( & mut self , _: ItemId ) { }
139+ fn visit_nested_item ( & mut self , _: ItemId ) -> ControlFlow < ( ) > {
140+ ControlFlow :: Continue ( ( ) )
141+ }
129142 }
130143 let mut v = V { f, res : None } ;
131144 node. visit ( & mut v) ;
132145 v. res
133146}
134147
135- /// Calls the given function once for each expression contained. This will enter bodies, but not
148+ /// Calls the given function once for each expression contained. This will enter bodies, bzut not
136149/// nested items.
137150pub fn for_each_expr_with_closures < ' tcx , B , C : Continue > (
138151 cx : & LateContext < ' tcx > ,
0 commit comments