@@ -859,28 +859,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
859
859
} )
860
860
. sum ( ) ;
861
861
862
- /// Look for `break` expressions within any arbitrary expressions. We'll do this to infer
863
- /// whether this is a case where the moved value would affect the exit of a loop, making it
864
- /// unsuitable for a `.clone()` suggestion.
865
- struct BreakFinder {
866
- found_breaks : Vec < ( hir:: Destination , Span ) > ,
867
- found_continues : Vec < ( hir:: Destination , Span ) > ,
868
- }
869
- impl < ' hir > Visitor < ' hir > for BreakFinder {
870
- fn visit_expr ( & mut self , ex : & ' hir hir:: Expr < ' hir > ) {
871
- match ex. kind {
872
- hir:: ExprKind :: Break ( destination, _) => {
873
- self . found_breaks . push ( ( destination, ex. span ) ) ;
874
- }
875
- hir:: ExprKind :: Continue ( destination) => {
876
- self . found_continues . push ( ( destination, ex. span ) ) ;
877
- }
878
- _ => { }
879
- }
880
- hir:: intravisit:: walk_expr ( self , ex) ;
881
- }
882
- }
883
-
884
862
let sm = tcx. sess . source_map ( ) ;
885
863
if let Some ( in_loop) = outer_most_loop {
886
864
let mut finder = BreakFinder { found_breaks : vec ! [ ] , found_continues : vec ! [ ] } ;
@@ -3943,6 +3921,28 @@ impl<'a, 'v> Visitor<'v> for ReferencedStatementsVisitor<'a> {
3943
3921
}
3944
3922
}
3945
3923
3924
+ /// Look for `break` expressions within any arbitrary expressions. We'll do this to infer
3925
+ /// whether this is a case where the moved value would affect the exit of a loop, making it
3926
+ /// unsuitable for a `.clone()` suggestion.
3927
+ struct BreakFinder {
3928
+ found_breaks : Vec < ( hir:: Destination , Span ) > ,
3929
+ found_continues : Vec < ( hir:: Destination , Span ) > ,
3930
+ }
3931
+ impl < ' hir > Visitor < ' hir > for BreakFinder {
3932
+ fn visit_expr ( & mut self , ex : & ' hir hir:: Expr < ' hir > ) {
3933
+ match ex. kind {
3934
+ hir:: ExprKind :: Break ( destination, _) => {
3935
+ self . found_breaks . push ( ( destination, ex. span ) ) ;
3936
+ }
3937
+ hir:: ExprKind :: Continue ( destination) => {
3938
+ self . found_continues . push ( ( destination, ex. span ) ) ;
3939
+ }
3940
+ _ => { }
3941
+ }
3942
+ hir:: intravisit:: walk_expr ( self , ex) ;
3943
+ }
3944
+ }
3945
+
3946
3946
/// Given a set of spans representing statements initializing the relevant binding, visit all the
3947
3947
/// function expressions looking for branching code paths that *do not* initialize the binding.
3948
3948
struct ConditionVisitor < ' b > {
0 commit comments