@@ -150,8 +150,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
150
150
Some ( mut descr) => {
151
151
// Surround descr with `backticks`.
152
152
descr. reserve ( 2 ) ;
153
- descr. insert_str ( 0 , "`" ) ;
154
- descr. push_str ( "`" ) ;
153
+ descr. insert ( 0 , '`' ) ;
154
+ descr. push ( '`' ) ;
155
155
descr
156
156
}
157
157
None => "value" . to_string ( ) ,
@@ -222,7 +222,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
222
222
if self . upvars [ var_index] . by_ref {
223
223
buf. push_str ( & name) ;
224
224
} else {
225
- buf. push_str ( & format ! ( "*{}" , & name) ) ;
225
+ buf. push ( '*' ) ;
226
+ buf. push_str ( & name) ;
226
227
}
227
228
} else {
228
229
if autoderef {
@@ -234,7 +235,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
234
235
& including_downcast,
235
236
) ?;
236
237
} else {
237
- buf. push_str ( & "*" ) ;
238
+ buf. push ( '*' ) ;
238
239
self . append_place_to_string (
239
240
PlaceRef { local, projection : proj_base } ,
240
241
buf,
@@ -272,7 +273,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
272
273
autoderef,
273
274
& including_downcast,
274
275
) ?;
275
- buf. push_str ( & format ! ( ".{}" , field_name) ) ;
276
+ buf. push ( '.' ) ;
277
+ buf. push_str ( & field_name) ;
276
278
}
277
279
}
278
280
ProjectionElem :: Index ( index) => {
@@ -284,11 +286,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
284
286
autoderef,
285
287
& including_downcast,
286
288
) ?;
287
- buf. push_str ( "[" ) ;
289
+ buf. push ( '[' ) ;
288
290
if self . append_local_to_string ( * index, buf) . is_err ( ) {
289
- buf. push_str ( "_" ) ;
291
+ buf. push ( '_' ) ;
290
292
}
291
- buf. push_str ( "]" ) ;
293
+ buf. push ( ']' ) ;
292
294
}
293
295
ProjectionElem :: ConstantIndex { .. } | ProjectionElem :: Subslice { .. } => {
294
296
autoderef = true ;
@@ -301,7 +303,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
301
303
autoderef,
302
304
& including_downcast,
303
305
) ?;
304
- buf. push_str ( & "[..]" ) ;
306
+ buf. push_str ( "[..]" ) ;
305
307
}
306
308
} ;
307
309
}
@@ -648,7 +650,7 @@ impl UseSpans {
648
650
" in closure" . to_string ( )
649
651
}
650
652
}
651
- _ => "" . to_string ( ) ,
653
+ _ => String :: new ( ) ,
652
654
}
653
655
}
654
656
0 commit comments