@@ -40,24 +40,23 @@ struct CheckLoanCtxt<'self> {
4040 reported : @mut HashSet < ast:: NodeId > ,
4141}
4242
43- struct CheckLoanVisitor ;
43+ impl < ' self > Visitor < ( ) > for CheckLoanCtxt < ' self > {
4444
45- impl < ' self > Visitor < CheckLoanCtxt < ' self > > for CheckLoanVisitor {
46- fn visit_expr < ' a > ( & mut self , ex : @ast:: Expr , e : CheckLoanCtxt < ' a > ) {
47- check_loans_in_expr ( self , ex, e) ;
45+ fn visit_expr ( & mut self , ex : @ast:: Expr , _: ( ) ) {
46+ check_loans_in_expr ( self , ex) ;
4847 }
49- fn visit_local ( & mut self , l : @ast:: Local , e : CheckLoanCtxt ) {
50- check_loans_in_local ( self , l, e ) ;
48+ fn visit_local ( & mut self , l : @ast:: Local , _ : ( ) ) {
49+ check_loans_in_local ( self , l) ;
5150 }
52- fn visit_block ( & mut self , b : & ast:: Block , e : CheckLoanCtxt ) {
53- check_loans_in_block ( self , b, e ) ;
51+ fn visit_block ( & mut self , b : & ast:: Block , _ : ( ) ) {
52+ check_loans_in_block ( self , b) ;
5453 }
55- fn visit_pat ( & mut self , p : @ast:: Pat , e : CheckLoanCtxt ) {
56- check_loans_in_pat ( self , p, e ) ;
54+ fn visit_pat ( & mut self , p : @ast:: Pat , _ : ( ) ) {
55+ check_loans_in_pat ( self , p) ;
5756 }
5857 fn visit_fn ( & mut self , fk : & visit:: fn_kind , fd : & ast:: fn_decl ,
59- b : & ast:: Block , s : Span , n : ast:: NodeId , e : CheckLoanCtxt ) {
60- check_loans_in_fn ( self , fk, fd, b, s, n, e ) ;
58+ b : & ast:: Block , s : Span , n : ast:: NodeId , _ : ( ) ) {
59+ check_loans_in_fn ( self , fk, fd, b, s, n) ;
6160 }
6261}
6362
@@ -68,16 +67,15 @@ pub fn check_loans(bccx: @BorrowckCtxt,
6867 body : & ast:: Block ) {
6968 debug ! ( "check_loans(body id=%?)" , body. id) ;
7069
71- let clcx = CheckLoanCtxt {
70+ let mut clcx = CheckLoanCtxt {
7271 bccx : bccx,
7372 dfcx_loans : dfcx_loans,
7473 move_data : @move_data,
7574 all_loans : all_loans,
7675 reported : @mut HashSet :: new ( ) ,
7776 } ;
7877
79- let mut vt = CheckLoanVisitor ;
80- vt. visit_block ( body, clcx) ;
78+ clcx. visit_block ( body, ( ) ) ;
8179}
8280
8381enum MoveError {
@@ -725,13 +723,12 @@ impl<'self> CheckLoanCtxt<'self> {
725723 }
726724}
727725
728- fn check_loans_in_fn < ' a > ( visitor : & mut CheckLoanVisitor ,
726+ fn check_loans_in_fn < ' a > ( this : & mut CheckLoanCtxt < ' a > ,
729727 fk : & visit:: fn_kind ,
730728 decl : & ast:: fn_decl ,
731729 body : & ast:: Block ,
732730 sp : Span ,
733- id : ast:: NodeId ,
734- this : CheckLoanCtxt < ' a > ) {
731+ id : ast:: NodeId ) {
735732 match * fk {
736733 visit:: fk_item_fn( * ) |
737734 visit:: fk_method( * ) => {
@@ -745,9 +742,9 @@ fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor,
745742 }
746743 }
747744
748- visit:: walk_fn ( visitor , fk, decl, body, sp, id, this ) ;
745+ visit:: walk_fn ( this , fk, decl, body, sp, id, ( ) ) ;
749746
750- fn check_captured_variables ( this : CheckLoanCtxt ,
747+ fn check_captured_variables ( this : & CheckLoanCtxt ,
751748 closure_id : ast:: NodeId ,
752749 span : Span ) {
753750 let cap_vars = this. bccx . capture_map . get ( & closure_id) ;
@@ -765,7 +762,7 @@ fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor,
765762 }
766763 return ;
767764
768- fn check_by_move_capture ( this : CheckLoanCtxt ,
765+ fn check_by_move_capture ( this : & CheckLoanCtxt ,
769766 closure_id : ast:: NodeId ,
770767 cap_var : & moves:: CaptureVar ,
771768 move_path : @LoanPath ) {
@@ -788,16 +785,14 @@ fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor,
788785 }
789786}
790787
791- fn check_loans_in_local < ' a > ( vt : & mut CheckLoanVisitor ,
792- local : @ast:: Local ,
793- this : CheckLoanCtxt < ' a > ) {
794- visit:: walk_local ( vt, local, this) ;
788+ fn check_loans_in_local < ' a > ( this : & mut CheckLoanCtxt < ' a > ,
789+ local : @ast:: Local ) {
790+ visit:: walk_local ( this, local, ( ) ) ;
795791}
796792
797- fn check_loans_in_expr < ' a > ( vt : & mut CheckLoanVisitor ,
798- expr : @ast:: Expr ,
799- this : CheckLoanCtxt < ' a > ) {
800- visit:: walk_expr ( vt, expr, this) ;
793+ fn check_loans_in_expr < ' a > ( this : & mut CheckLoanCtxt < ' a > ,
794+ expr : @ast:: Expr ) {
795+ visit:: walk_expr ( this, expr, ( ) ) ;
801796
802797 debug ! ( "check_loans_in_expr(expr=%s)" ,
803798 expr. repr( this. tcx( ) ) ) ;
@@ -848,20 +843,18 @@ fn check_loans_in_expr<'a>(vt: &mut CheckLoanVisitor,
848843 }
849844}
850845
851- fn check_loans_in_pat < ' a > ( vt : & mut CheckLoanVisitor ,
852- pat : @ast:: Pat ,
853- this : CheckLoanCtxt < ' a > )
846+ fn check_loans_in_pat < ' a > ( this : & mut CheckLoanCtxt < ' a > ,
847+ pat : @ast:: Pat )
854848{
855849 this. check_for_conflicting_loans ( pat. id ) ;
856850 this. check_move_out_from_id ( pat. id , pat. span ) ;
857- visit:: walk_pat ( vt , pat, this ) ;
851+ visit:: walk_pat ( this , pat, ( ) ) ;
858852}
859853
860- fn check_loans_in_block < ' a > ( vt : & mut CheckLoanVisitor ,
861- blk : & ast:: Block ,
862- this : CheckLoanCtxt < ' a > )
854+ fn check_loans_in_block < ' a > ( this : & mut CheckLoanCtxt < ' a > ,
855+ blk : & ast:: Block )
863856{
864- visit:: walk_block ( vt , blk, this ) ;
857+ visit:: walk_block ( this , blk, ( ) ) ;
865858 this. check_for_conflicting_loans ( blk. id ) ;
866859}
867860
0 commit comments