@@ -71,30 +71,29 @@ pub struct DumpCsvVisitor<'l, 'tcx: 'l> {
7171 span : SpanUtils < ' l > ,
7272 fmt : FmtStrs < ' l > ,
7373
74- cur_scope : NodeId
74+ cur_scope : NodeId ,
7575}
7676
7777impl < ' l , ' tcx > DumpCsvVisitor < ' l , ' tcx > {
7878 pub fn new ( tcx : & ' l ty:: ctxt < ' tcx > ,
7979 analysis : & ' l ty:: CrateAnalysis ,
80- output_file : Box < File > ) -> DumpCsvVisitor < ' l , ' tcx > {
80+ output_file : Box < File > )
81+ -> DumpCsvVisitor < ' l , ' tcx > {
8182 let span_utils = SpanUtils :: new ( & tcx. sess ) ;
8283 DumpCsvVisitor {
8384 sess : & tcx. sess ,
8485 tcx : tcx,
8586 save_ctxt : SaveContext :: from_span_utils ( tcx, span_utils. clone ( ) ) ,
8687 analysis : analysis,
8788 span : span_utils. clone ( ) ,
88- fmt : FmtStrs :: new ( box Recorder {
89- out : output_file,
90- dump_spans : false ,
91- } , span_utils) ,
92- cur_scope : 0
89+ fmt : FmtStrs :: new ( box Recorder { out : output_file, dump_spans : false } ,
90+ span_utils) ,
91+ cur_scope : 0 ,
9392 }
9493 }
9594
96- fn nest < F > ( & mut self , scope_id : NodeId , f : F ) where
97- F : FnOnce ( & mut DumpCsvVisitor < ' l , ' tcx > ) ,
95+ fn nest < F > ( & mut self , scope_id : NodeId , f : F )
96+ where F : FnOnce ( & mut DumpCsvVisitor < ' l , ' tcx > )
9897 {
9998 let parent_scope = self . cur_scope ;
10099 self . cur_scope = scope_id;
@@ -140,9 +139,11 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
140139 let mut segs = vec ! ( ) ;
141140 for ( i, ( seg, span) ) in path. segments . iter ( ) . zip ( & spans) . enumerate ( ) {
142141 segs. push ( seg. clone ( ) ) ;
143- let sub_path = ast:: Path { span : * span, // span for the last segment
144- global : path. global ,
145- segments : segs} ;
142+ let sub_path = ast:: Path {
143+ span : * span, // span for the last segment
144+ global : path. global ,
145+ segments : segs,
146+ } ;
146147 let qualname = if i == 0 && path. global {
147148 format ! ( "::{}" , path_to_string( & sub_path) )
148149 } else {
@@ -271,7 +272,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
271272 def:: DefPrimTy ( _) => {
272273 self . sess . span_bug ( span, & format ! ( "lookup_def_kind for unexpected item: {:?}" ,
273274 def) ) ;
274- } ,
275+ }
275276 }
276277 }
277278
@@ -357,9 +358,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
357358 }
358359 }
359360
360- fn process_struct_field_def ( & mut self ,
361- field : & ast:: StructField ,
362- parent_id : NodeId ) {
361+ fn process_struct_field_def ( & mut self , field : & ast:: StructField , parent_id : NodeId ) {
363362 let field_data = self . save_ctxt . get_field_data ( field, parent_id) ;
364363 if let Some ( field_data) = field_data {
365364 self . fmt . field_str ( field. span ,
@@ -374,7 +373,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
374373
375374 // Dump generic params bindings, then visit_generics
376375 fn process_generic_params ( & mut self ,
377- generics : & ast:: Generics ,
376+ generics : & ast:: Generics ,
378377 full_span : Span ,
379378 prefix : & str ,
380379 id : NodeId ) {
@@ -427,11 +426,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
427426 self . nest ( item. id , |v| v. visit_block ( & body) ) ;
428427 }
429428
430- fn process_static_or_const_item ( & mut self ,
431- item : & ast:: Item ,
432- typ : & ast:: Ty ,
433- expr : & ast:: Expr )
434- {
429+ fn process_static_or_const_item ( & mut self , item : & ast:: Item , typ : & ast:: Ty , expr : & ast:: Expr ) {
435430 let var_data = self . save_ctxt . get_item_data ( item) ;
436431 down_cast_data ! ( var_data, VariableData , self , item. span) ;
437432 self . fmt . static_str ( item. span ,
@@ -452,8 +447,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
452447 ident : & ast:: Ident ,
453448 span : Span ,
454449 typ : & ast:: Ty ,
455- expr : & ast:: Expr )
456- {
450+ expr : & ast:: Expr ) {
457451 let qualname = format ! ( "::{}" , self . tcx. map. path_to_string( id) ) ;
458452
459453 let sub_span = self . span . sub_span_after_keyword ( span,
@@ -641,8 +635,8 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
641635 sub_span,
642636 id,
643637 item. id ) ;
644- } ,
645- None => ( )
638+ }
639+ None => ( ) ,
646640 }
647641 }
648642
@@ -653,8 +647,8 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
653647 }
654648 }
655649
656- fn process_mod ( & mut self ,
657- item : & ast:: Item ) { // The module in question, represented as an item.
650+ // `item` is the module in question, represented as an item.
651+ fn process_mod ( & mut self , item : & ast:: Item ) {
658652 let mod_data = self . save_ctxt . get_item_data ( item) ;
659653 down_cast_data ! ( mod_data, ModData , self , item. span) ;
660654 self . fmt . mod_str ( item. span ,
@@ -665,10 +659,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
665659 & mod_data. filename ) ;
666660 }
667661
668- fn process_path ( & mut self ,
669- id : NodeId ,
670- path : & ast:: Path ,
671- ref_kind : Option < recorder:: Row > ) {
662+ fn process_path ( & mut self , id : NodeId , path : & ast:: Path , ref_kind : Option < recorder:: Row > ) {
672663 if generated_code ( path. span ) {
673664 return ;
674665 }
@@ -737,7 +728,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
737728 def:: DefStruct ( _) |
738729 def:: DefVariant ( ..) |
739730 def:: DefFn ( ..) => self . write_sub_paths_truncated ( path, false ) ,
740- _ => { } ,
731+ _ => { }
741732 }
742733 }
743734
@@ -783,9 +774,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
783774 visit:: walk_expr_opt ( self , base)
784775 }
785776
786- fn process_method_call ( & mut self ,
787- ex : & ast:: Expr ,
788- args : & Vec < P < ast:: Expr > > ) {
777+ fn process_method_call ( & mut self , ex : & ast:: Expr , args : & Vec < P < ast:: Expr > > ) {
789778 if let Some ( call_data) = self . save_ctxt . get_expr_data ( ex) {
790779 down_cast_data ! ( call_data, MethodCallData , self , ex. span) ;
791780 self . fmt . meth_call_str ( ex. span ,
@@ -799,7 +788,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
799788 visit:: walk_exprs ( self , & args) ;
800789 }
801790
802- fn process_pat ( & mut self , p : & ast:: Pat ) {
791+ fn process_pat ( & mut self , p : & ast:: Pat ) {
803792 if generated_code ( p. span ) {
804793 return ;
805794 }
@@ -827,7 +816,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
827816 self . visit_pat ( & field. pat ) ;
828817 }
829818 }
830- _ => visit:: walk_pat ( self , p)
819+ _ => visit:: walk_pat ( self , p) ,
831820 }
832821 }
833822}
@@ -851,10 +840,10 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
851840 sub_span,
852841 def_id,
853842 self . cur_scope ) ,
854- None => { } ,
843+ None => { }
855844 }
856845 Some ( def_id)
857- } ,
846+ }
858847 None => None ,
859848 } ;
860849
@@ -902,20 +891,19 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
902891 match plid. node {
903892 ast:: PathListIdent { id, .. } => {
904893 match self . lookup_type_ref ( id) {
905- Some ( def_id) =>
906- match self . lookup_def_kind ( id, plid. span ) {
907- Some ( kind) => {
908- self . fmt . ref_str (
894+ Some ( def_id) => match self . lookup_def_kind ( id, plid. span ) {
895+ Some ( kind) => {
896+ self . fmt . ref_str (
909897 kind, plid. span ,
910898 Some ( plid. span ) ,
911899 def_id, self . cur_scope ) ;
912- }
913- None => ( )
914- } ,
915- None => ( )
900+ }
901+ None => ( ) ,
902+ } ,
903+ None => ( ) ,
916904 }
917- } ,
918- ast:: PathListMod { .. } => ( )
905+ }
906+ ast:: PathListMod { .. } => ( ) ,
919907 }
920908 }
921909
@@ -978,7 +966,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
978966
979967 self . visit_ty ( & * * ty) ;
980968 self . process_generic_params ( ty_params, item. span , & qualname, item. id ) ;
981- } ,
969+ }
982970 ast:: ItemMac ( _) => ( ) ,
983971 _ => visit:: walk_item ( self , item) ,
984972 }
@@ -1048,14 +1036,14 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
10481036 sub_span,
10491037 id,
10501038 self . cur_scope ) ;
1051- } ,
1052- None => ( )
1039+ }
1040+ None => ( ) ,
10531041 }
10541042
10551043 self . write_sub_paths_truncated ( path, false ) ;
10561044
10571045 visit:: walk_path ( self , path) ;
1058- } ,
1046+ }
10591047 _ => visit:: walk_ty ( self , t) ,
10601048 }
10611049 }
@@ -1101,7 +1089,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
11011089 field_data. ref_id ,
11021090 field_data. scope ) ;
11031091 }
1104- } ,
1092+ }
11051093 ast:: ExprTupField ( ref sub_ex, idx) => {
11061094 if generated_code ( sub_ex. span ) {
11071095 return
@@ -1125,7 +1113,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
11251113 & format ! ( "Expected struct or tuple \
11261114 type, found {:?}", ty) ) ,
11271115 }
1128- } ,
1116+ }
11291117 ast:: ExprClosure ( _, ref decl, ref body) => {
11301118 if generated_code ( body. span ) {
11311119 return
@@ -1146,7 +1134,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
11461134
11471135 // walk the body
11481136 self . nest ( ex. id , |v| v. visit_block ( & * * body) ) ;
1149- } ,
1137+ }
11501138 _ => {
11511139 visit:: walk_expr ( self , ex)
11521140 }
@@ -1182,7 +1170,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
11821170 }
11831171 let def = def_map. get ( & id) . unwrap ( ) . full_def ( ) ;
11841172 match def {
1185- def:: DefLocal ( id) => {
1173+ def:: DefLocal ( id) => {
11861174 let value = if immut == ast:: MutImmutable {
11871175 self . span . snippet ( p. span ) . to_string ( )
11881176 } else {
@@ -1205,7 +1193,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
12051193 def:: DefConst ( ..) |
12061194 def:: DefAssociatedConst ( ..) => { }
12071195 _ => error ! ( "unexpected definition kind when processing collected paths: {:?}" ,
1208- def)
1196+ def) ,
12091197 }
12101198 }
12111199
0 commit comments