@@ -150,8 +150,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
150150 Some ( mut descr) => {
151151 // Surround descr with `backticks`.
152152 descr. reserve ( 2 ) ;
153- descr. insert_str ( 0 , "`" ) ;
154- descr. push_str ( "`" ) ;
153+ descr. insert ( 0 , '`' ) ;
154+ descr. push ( '`' ) ;
155155 descr
156156 }
157157 None => "value" . to_string ( ) ,
@@ -222,7 +222,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
222222 if self . upvars [ var_index] . by_ref {
223223 buf. push_str ( & name) ;
224224 } else {
225- buf. push_str ( & format ! ( "*{}" , & name) ) ;
225+ buf. push ( '*' ) ;
226+ buf. push_str ( & name) ;
226227 }
227228 } else {
228229 if autoderef {
@@ -234,7 +235,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
234235 & including_downcast,
235236 ) ?;
236237 } else {
237- buf. push_str ( & "*" ) ;
238+ buf. push ( '*' ) ;
238239 self . append_place_to_string (
239240 PlaceRef { local, projection : proj_base } ,
240241 buf,
@@ -272,7 +273,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
272273 autoderef,
273274 & including_downcast,
274275 ) ?;
275- buf. push_str ( & format ! ( ".{}" , field_name) ) ;
276+ buf. push ( '.' ) ;
277+ buf. push_str ( & field_name) ;
276278 }
277279 }
278280 ProjectionElem :: Index ( index) => {
@@ -284,11 +286,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
284286 autoderef,
285287 & including_downcast,
286288 ) ?;
287- buf. push_str ( "[" ) ;
289+ buf. push ( '[' ) ;
288290 if self . append_local_to_string ( * index, buf) . is_err ( ) {
289- buf. push_str ( "_" ) ;
291+ buf. push ( '_' ) ;
290292 }
291- buf. push_str ( "]" ) ;
293+ buf. push ( ']' ) ;
292294 }
293295 ProjectionElem :: ConstantIndex { .. } | ProjectionElem :: Subslice { .. } => {
294296 autoderef = true ;
@@ -301,7 +303,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
301303 autoderef,
302304 & including_downcast,
303305 ) ?;
304- buf. push_str ( & "[..]" ) ;
306+ buf. push_str ( "[..]" ) ;
305307 }
306308 } ;
307309 }
@@ -648,7 +650,7 @@ impl UseSpans {
648650 " in closure" . to_string ( )
649651 }
650652 }
651- _ => "" . to_string ( ) ,
653+ _ => String :: new ( ) ,
652654 }
653655 }
654656
0 commit comments