@@ -147,9 +147,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
147
147
let crate_root = source_file. map ( |source_file| {
148
148
let source_file = Path :: new ( source_file) ;
149
149
match source_file. file_name ( ) {
150
- Some ( _) => source_file. parent ( ) . unwrap ( ) . display ( ) . to_string ( ) ,
151
- None => source_file. display ( ) . to_string ( ) ,
152
- }
150
+ Some ( _) => source_file. parent ( ) . unwrap ( ) . display ( ) ,
151
+ None => source_file. display ( ) ,
152
+ } . to_string ( )
153
153
} ) ;
154
154
155
155
let data = CratePreludeData {
@@ -176,8 +176,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
176
176
let segments = & path. segments [ if path. is_global ( ) { 1 } else { 0 } ..] ;
177
177
178
178
let mut result = Vec :: with_capacity ( segments. len ( ) ) ;
179
+ let mut segs = Vec :: with_capacity ( segments. len ( ) ) ;
179
180
180
- let mut segs = vec ! [ ] ;
181
181
for ( i, seg) in segments. iter ( ) . enumerate ( ) {
182
182
segs. push ( seg. clone ( ) ) ;
183
183
let sub_path = ast:: Path {
@@ -591,9 +591,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
591
591
592
592
for variant in & enum_definition. variants {
593
593
let name = variant. node . ident . name . to_string ( ) ;
594
- let mut qualname = enum_data. qualname . clone ( ) ;
595
- qualname. push_str ( "::" ) ;
596
- qualname. push_str ( & name) ;
594
+ let qualname = format ! ( "{}::{}" , enum_data. qualname, name) ;
597
595
598
596
match variant. node . data {
599
597
ast:: VariantData :: Struct ( ref fields, _) => {
@@ -973,9 +971,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
973
971
match self . save_ctxt . get_path_def ( id) {
974
972
HirDef :: Local ( id) => {
975
973
let mut value = if immut == ast:: Mutability :: Immutable {
976
- self . span . snippet ( ident. span ) . to_string ( )
974
+ self . span . snippet ( ident. span )
977
975
} else {
978
- "<mutable>" . to_string ( )
976
+ "<mutable>" . to_owned ( )
979
977
} ;
980
978
let hir_id = self . tcx . hir . node_to_hir_id ( id) ;
981
979
let typ = self . save_ctxt
@@ -1103,10 +1101,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
1103
1101
/// mac_uses and mac_defs sets to prevent multiples.
1104
1102
fn process_macro_use ( & mut self , span : Span ) {
1105
1103
let source_span = span. source_callsite ( ) ;
1106
- if self . macro_calls . contains ( & source_span) {
1104
+ if ! self . macro_calls . insert ( source_span) {
1107
1105
return ;
1108
1106
}
1109
- self . macro_calls . insert ( source_span) ;
1110
1107
1111
1108
let data = match self . save_ctxt . get_macro_use_data ( span) {
1112
1109
None => return ,
@@ -1608,8 +1605,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
1608
1605
}
1609
1606
}
1610
1607
ast:: ExprKind :: Closure ( _, _, _, ref decl, ref body, _fn_decl_span) => {
1611
- let mut id = String :: from ( "$" ) ;
1612
- id. push_str ( & ex. id . to_string ( ) ) ;
1608
+ let id = format ! ( "${}" , ex. id) ;
1613
1609
1614
1610
// walk arg and return types
1615
1611
for arg in & decl. inputs {
0 commit comments