@@ -71,30 +71,29 @@ pub struct DumpCsvVisitor<'l, 'tcx: 'l> {
71
71
span : SpanUtils < ' l > ,
72
72
fmt : FmtStrs < ' l > ,
73
73
74
- cur_scope : NodeId
74
+ cur_scope : NodeId ,
75
75
}
76
76
77
77
impl < ' l , ' tcx > DumpCsvVisitor < ' l , ' tcx > {
78
78
pub fn new ( tcx : & ' l ty:: ctxt < ' tcx > ,
79
79
analysis : & ' l ty:: CrateAnalysis ,
80
- output_file : Box < File > ) -> DumpCsvVisitor < ' l , ' tcx > {
80
+ output_file : Box < File > )
81
+ -> DumpCsvVisitor < ' l , ' tcx > {
81
82
let span_utils = SpanUtils :: new ( & tcx. sess ) ;
82
83
DumpCsvVisitor {
83
84
sess : & tcx. sess ,
84
85
tcx : tcx,
85
86
save_ctxt : SaveContext :: from_span_utils ( tcx, span_utils. clone ( ) ) ,
86
87
analysis : analysis,
87
88
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 ,
93
92
}
94
93
}
95
94
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 > )
98
97
{
99
98
let parent_scope = self . cur_scope ;
100
99
self . cur_scope = scope_id;
@@ -140,9 +139,11 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
140
139
let mut segs = vec ! ( ) ;
141
140
for ( i, ( seg, span) ) in path. segments . iter ( ) . zip ( & spans) . enumerate ( ) {
142
141
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
+ } ;
146
147
let qualname = if i == 0 && path. global {
147
148
format ! ( "::{}" , path_to_string( & sub_path) )
148
149
} else {
@@ -271,7 +272,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
271
272
def:: DefPrimTy ( _) => {
272
273
self . sess . span_bug ( span, & format ! ( "lookup_def_kind for unexpected item: {:?}" ,
273
274
def) ) ;
274
- } ,
275
+ }
275
276
}
276
277
}
277
278
@@ -357,9 +358,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
357
358
}
358
359
}
359
360
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 ) {
363
362
let field_data = self . save_ctxt . get_field_data ( field, parent_id) ;
364
363
if let Some ( field_data) = field_data {
365
364
self . fmt . field_str ( field. span ,
@@ -374,7 +373,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
374
373
375
374
// Dump generic params bindings, then visit_generics
376
375
fn process_generic_params ( & mut self ,
377
- generics : & ast:: Generics ,
376
+ generics : & ast:: Generics ,
378
377
full_span : Span ,
379
378
prefix : & str ,
380
379
id : NodeId ) {
@@ -427,11 +426,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
427
426
self . nest ( item. id , |v| v. visit_block ( & body) ) ;
428
427
}
429
428
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 ) {
435
430
let var_data = self . save_ctxt . get_item_data ( item) ;
436
431
down_cast_data ! ( var_data, VariableData , self , item. span) ;
437
432
self . fmt . static_str ( item. span ,
@@ -452,8 +447,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
452
447
ident : & ast:: Ident ,
453
448
span : Span ,
454
449
typ : & ast:: Ty ,
455
- expr : & ast:: Expr )
456
- {
450
+ expr : & ast:: Expr ) {
457
451
let qualname = format ! ( "::{}" , self . tcx. map. path_to_string( id) ) ;
458
452
459
453
let sub_span = self . span . sub_span_after_keyword ( span,
@@ -641,8 +635,8 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
641
635
sub_span,
642
636
id,
643
637
item. id ) ;
644
- } ,
645
- None => ( )
638
+ }
639
+ None => ( ) ,
646
640
}
647
641
}
648
642
@@ -653,8 +647,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
653
647
}
654
648
}
655
649
656
- fn process_mod ( & mut self ,
657
- item : & ast:: Item ) { // The module in question, represented as an item.
650
+ fn process_mod ( & mut self , item : & ast:: Item ) { // The module in question, represented as an item.
658
651
let mod_data = self . save_ctxt . get_item_data ( item) ;
659
652
down_cast_data ! ( mod_data, ModData , self , item. span) ;
660
653
self . fmt . mod_str ( item. span ,
@@ -665,10 +658,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
665
658
& mod_data. filename ) ;
666
659
}
667
660
668
- fn process_path ( & mut self ,
669
- id : NodeId ,
670
- path : & ast:: Path ,
671
- ref_kind : Option < recorder:: Row > ) {
661
+ fn process_path ( & mut self , id : NodeId , path : & ast:: Path , ref_kind : Option < recorder:: Row > ) {
672
662
if generated_code ( path. span ) {
673
663
return ;
674
664
}
@@ -737,7 +727,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
737
727
def:: DefStruct ( _) |
738
728
def:: DefVariant ( ..) |
739
729
def:: DefFn ( ..) => self . write_sub_paths_truncated ( path, false ) ,
740
- _ => { } ,
730
+ _ => { }
741
731
}
742
732
}
743
733
@@ -783,9 +773,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
783
773
visit:: walk_expr_opt ( self , base)
784
774
}
785
775
786
- fn process_method_call ( & mut self ,
787
- ex : & ast:: Expr ,
788
- args : & Vec < P < ast:: Expr > > ) {
776
+ fn process_method_call ( & mut self , ex : & ast:: Expr , args : & Vec < P < ast:: Expr > > ) {
789
777
if let Some ( call_data) = self . save_ctxt . get_expr_data ( ex) {
790
778
down_cast_data ! ( call_data, MethodCallData , self , ex. span) ;
791
779
self . fmt . meth_call_str ( ex. span ,
@@ -799,7 +787,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
799
787
visit:: walk_exprs ( self , & args) ;
800
788
}
801
789
802
- fn process_pat ( & mut self , p : & ast:: Pat ) {
790
+ fn process_pat ( & mut self , p : & ast:: Pat ) {
803
791
if generated_code ( p. span ) {
804
792
return ;
805
793
}
@@ -827,7 +815,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
827
815
self . visit_pat ( & field. pat ) ;
828
816
}
829
817
}
830
- _ => visit:: walk_pat ( self , p)
818
+ _ => visit:: walk_pat ( self , p) ,
831
819
}
832
820
}
833
821
}
@@ -851,10 +839,10 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
851
839
sub_span,
852
840
def_id,
853
841
self . cur_scope ) ,
854
- None => { } ,
842
+ None => { }
855
843
}
856
844
Some ( def_id)
857
- } ,
845
+ }
858
846
None => None ,
859
847
} ;
860
848
@@ -902,20 +890,19 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
902
890
match plid. node {
903
891
ast:: PathListIdent { id, .. } => {
904
892
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 (
893
+ Some ( def_id) => match self . lookup_def_kind ( id, plid. span ) {
894
+ Some ( kind) => {
895
+ self . fmt . ref_str (
909
896
kind, plid. span ,
910
897
Some ( plid. span ) ,
911
898
def_id, self . cur_scope ) ;
912
- }
913
- None => ( )
914
- } ,
915
- None => ( )
899
+ }
900
+ None => ( ) ,
901
+ } ,
902
+ None => ( ) ,
916
903
}
917
- } ,
918
- ast:: PathListMod { .. } => ( )
904
+ }
905
+ ast:: PathListMod { .. } => ( ) ,
919
906
}
920
907
}
921
908
@@ -978,7 +965,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
978
965
979
966
self . visit_ty ( & * * ty) ;
980
967
self . process_generic_params ( ty_params, item. span , & qualname, item. id ) ;
981
- } ,
968
+ }
982
969
ast:: ItemMac ( _) => ( ) ,
983
970
_ => visit:: walk_item ( self , item) ,
984
971
}
@@ -1048,14 +1035,14 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1048
1035
sub_span,
1049
1036
id,
1050
1037
self . cur_scope ) ;
1051
- } ,
1052
- None => ( )
1038
+ }
1039
+ None => ( ) ,
1053
1040
}
1054
1041
1055
1042
self . write_sub_paths_truncated ( path, false ) ;
1056
1043
1057
1044
visit:: walk_path ( self , path) ;
1058
- } ,
1045
+ }
1059
1046
_ => visit:: walk_ty ( self , t) ,
1060
1047
}
1061
1048
}
@@ -1101,7 +1088,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1101
1088
field_data. ref_id ,
1102
1089
field_data. scope ) ;
1103
1090
}
1104
- } ,
1091
+ }
1105
1092
ast:: ExprTupField ( ref sub_ex, idx) => {
1106
1093
if generated_code ( sub_ex. span ) {
1107
1094
return
@@ -1125,7 +1112,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1125
1112
& format ! ( "Expected struct or tuple \
1126
1113
type, found {:?}", ty) ) ,
1127
1114
}
1128
- } ,
1115
+ }
1129
1116
ast:: ExprClosure ( _, ref decl, ref body) => {
1130
1117
if generated_code ( body. span ) {
1131
1118
return
@@ -1146,7 +1133,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1146
1133
1147
1134
// walk the body
1148
1135
self . nest ( ex. id , |v| v. visit_block ( & * * body) ) ;
1149
- } ,
1136
+ }
1150
1137
_ => {
1151
1138
visit:: walk_expr ( self , ex)
1152
1139
}
@@ -1182,7 +1169,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1182
1169
}
1183
1170
let def = def_map. get ( & id) . unwrap ( ) . full_def ( ) ;
1184
1171
match def {
1185
- def:: DefLocal ( id) => {
1172
+ def:: DefLocal ( id) => {
1186
1173
let value = if immut == ast:: MutImmutable {
1187
1174
self . span . snippet ( p. span ) . to_string ( )
1188
1175
} else {
@@ -1205,7 +1192,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
1205
1192
def:: DefConst ( ..) |
1206
1193
def:: DefAssociatedConst ( ..) => { }
1207
1194
_ => error ! ( "unexpected definition kind when processing collected paths: {:?}" ,
1208
- def)
1195
+ def) ,
1209
1196
}
1210
1197
}
1211
1198
0 commit comments