@@ -147,9 +147,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
147147 let crate_root = source_file. map ( |source_file| {
148148 let source_file = Path :: new ( source_file) ;
149149 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 ( )
153153 } ) ;
154154
155155 let data = CratePreludeData {
@@ -176,8 +176,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
176176 let segments = & path. segments [ if path. is_global ( ) { 1 } else { 0 } ..] ;
177177
178178 let mut result = Vec :: with_capacity ( segments. len ( ) ) ;
179+ let mut segs = Vec :: with_capacity ( segments. len ( ) ) ;
179180
180- let mut segs = vec ! [ ] ;
181181 for ( i, seg) in segments. iter ( ) . enumerate ( ) {
182182 segs. push ( seg. clone ( ) ) ;
183183 let sub_path = ast:: Path {
@@ -591,9 +591,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
591591
592592 for variant in & enum_definition. variants {
593593 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) ;
597595
598596 match variant. node . data {
599597 ast:: VariantData :: Struct ( ref fields, _) => {
@@ -973,9 +971,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
973971 match self . save_ctxt . get_path_def ( id) {
974972 HirDef :: Local ( id) => {
975973 let mut value = if immut == ast:: Mutability :: Immutable {
976- self . span . snippet ( ident. span ) . to_string ( )
974+ self . span . snippet ( ident. span )
977975 } else {
978- "<mutable>" . to_string ( )
976+ "<mutable>" . to_owned ( )
979977 } ;
980978 let hir_id = self . tcx . hir . node_to_hir_id ( id) ;
981979 let typ = self . save_ctxt
@@ -1103,10 +1101,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
11031101 /// mac_uses and mac_defs sets to prevent multiples.
11041102 fn process_macro_use ( & mut self , span : Span ) {
11051103 let source_span = span. source_callsite ( ) ;
1106- if self . macro_calls . contains ( & source_span) {
1104+ if ! self . macro_calls . insert ( source_span) {
11071105 return ;
11081106 }
1109- self . macro_calls . insert ( source_span) ;
11101107
11111108 let data = match self . save_ctxt . get_macro_use_data ( span) {
11121109 None => return ,
@@ -1608,8 +1605,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
16081605 }
16091606 }
16101607 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) ;
16131609
16141610 // walk arg and return types
16151611 for arg in & decl. inputs {
0 commit comments