@@ -653,7 +653,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
653653 err. span_suggestion_verbose (
654654 sugg_span. shrink_to_hi ( ) ,
655655 "consider assigning a value" ,
656- format ! ( " = {}" , assign_value ) ,
656+ format ! ( " = {assign_value}" ) ,
657657 Applicability :: MaybeIncorrect ,
658658 ) ;
659659 }
@@ -738,7 +738,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
738738 // Try to find predicates on *generic params* that would allow copying `ty`
739739 let suggestion =
740740 if let Some ( symbol) = tcx. hir ( ) . maybe_get_struct_pattern_shorthand_field ( expr) {
741- format ! ( ": {}.clone()" , symbol )
741+ format ! ( ": {symbol }.clone()" )
742742 } else {
743743 ".clone()" . to_owned ( )
744744 } ;
@@ -1162,8 +1162,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11621162
11631163 if union_type_name != "" {
11641164 err. note ( format ! (
1165- "{} is a field of the union `{}`, so it overlaps the field {}" ,
1166- msg_place, union_type_name, msg_borrow,
1165+ "{msg_place} is a field of the union `{union_type_name}`, so it overlaps the field {msg_borrow}" ,
11671166 ) ) ;
11681167 }
11691168
@@ -1353,8 +1352,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13531352 let Some ( trait_did) = tcx. trait_of_item ( def_id) &&
13541353 tcx. is_diagnostic_item ( sym:: Iterator , trait_did) {
13551354 err. note ( format ! (
1356- "a for loop advances the iterator for you, the result is stored in `{}`." ,
1357- loop_bind
1355+ "a for loop advances the iterator for you, the result is stored in `{loop_bind}`."
13581356 ) ) ;
13591357 err. help ( "if you want to call `next` on a iterator within the loop, consider using `while let`." ) ;
13601358 }
@@ -1825,7 +1823,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
18251823 } ,
18261824 ConstraintCategory :: CallArgument ( None ) ,
18271825 var_or_use_span,
1828- & format ! ( "`{}`" , name ) ,
1826+ & format ! ( "`{name }`" ) ,
18291827 "block" ,
18301828 ) ,
18311829 (
@@ -1847,7 +1845,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
18471845 region_name,
18481846 category,
18491847 span,
1850- & format ! ( "`{}`" , name ) ,
1848+ & format ! ( "`{name }`" ) ,
18511849 "function" ,
18521850 ) ,
18531851 (
@@ -1921,14 +1919,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19211919 }
19221920 }
19231921
1924- let mut err = self . path_does_not_live_long_enough ( borrow_span, & format ! ( "`{}`" , name ) ) ;
1922+ let mut err = self . path_does_not_live_long_enough ( borrow_span, & format ! ( "`{name }`" ) ) ;
19251923
19261924 if let Some ( annotation) = self . annotate_argument_and_return_for_borrow ( borrow) {
19271925 let region_name = annotation. emit ( self , & mut err) ;
19281926
19291927 err. span_label (
19301928 borrow_span,
1931- format ! ( "`{}` would have to be valid for `{}`..." , name , region_name ) ,
1929+ format ! ( "`{name }` would have to be valid for `{region_name }`..." ) ,
19321930 ) ;
19331931
19341932 err. span_label (
@@ -1939,7 +1937,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19391937 self . infcx
19401938 . tcx
19411939 . opt_item_name( self . mir_def_id( ) . to_def_id( ) )
1942- . map( |name| format!( "function `{}`" , name ) )
1940+ . map( |name| format!( "function `{name }`" ) )
19431941 . unwrap_or_else( || {
19441942 match & self . infcx. tcx. def_kind( self . mir_def_id( ) ) {
19451943 DefKind :: Closure => "enclosing closure" ,
@@ -1974,7 +1972,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
19741972 }
19751973 } else {
19761974 err. span_label ( borrow_span, "borrowed value does not live long enough" ) ;
1977- err. span_label ( drop_span, format ! ( "`{}` dropped here while still borrowed" , name ) ) ;
1975+ err. span_label ( drop_span, format ! ( "`{name }` dropped here while still borrowed" ) ) ;
19781976
19791977 borrow_spans. args_subdiag ( & mut err, |args_span| {
19801978 crate :: session_diagnostics:: CaptureArgLabel :: Capture {
@@ -2018,22 +2016,17 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
20182016 let mut err = self . cannot_borrow_across_destructor ( borrow_span) ;
20192017
20202018 let what_was_dropped = match self . describe_place ( place. as_ref ( ) ) {
2021- Some ( name) => format ! ( "`{}`" , name ) ,
2019+ Some ( name) => format ! ( "`{name }`" ) ,
20222020 None => String :: from ( "temporary value" ) ,
20232021 } ;
20242022
20252023 let label = match self . describe_place ( borrow. borrowed_place . as_ref ( ) ) {
20262024 Some ( borrowed) => format ! (
2027- "here, drop of {D} needs exclusive access to `{B}`, \
2028- because the type `{T}` implements the `Drop` trait",
2029- D = what_was_dropped,
2030- T = dropped_ty,
2031- B = borrowed
2025+ "here, drop of {what_was_dropped} needs exclusive access to `{borrowed}`, \
2026+ because the type `{dropped_ty}` implements the `Drop` trait"
20322027 ) ,
20332028 None => format ! (
2034- "here is drop of {D}; whose type `{T}` implements the `Drop` trait" ,
2035- D = what_was_dropped,
2036- T = dropped_ty
2029+ "here is drop of {what_was_dropped}; whose type `{dropped_ty}` implements the `Drop` trait"
20372030 ) ,
20382031 } ;
20392032 err. span_label ( drop_span, label) ;
@@ -2245,10 +2238,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
22452238 } else {
22462239 "local data "
22472240 } ;
2248- (
2249- format ! ( "{}`{}`" , local_kind, place_desc) ,
2250- format ! ( "`{}` is borrowed here" , place_desc) ,
2251- )
2241+ ( format ! ( "{local_kind}`{place_desc}`" ) , format ! ( "`{place_desc}` is borrowed here" ) )
22522242 } else {
22532243 let root_place =
22542244 self . prefixes ( borrow. borrowed_place . as_ref ( ) , PrefixSet :: All ) . last ( ) . unwrap ( ) ;
@@ -2350,17 +2340,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
23502340 err. span_suggestion_verbose (
23512341 sugg_span,
23522342 format ! (
2353- "to force the {} to take ownership of {} (and any \
2354- other referenced variables), use the `move` keyword",
2355- kind, captured_var
2343+ "to force the {kind} to take ownership of {captured_var} (and any \
2344+ other referenced variables), use the `move` keyword"
23562345 ) ,
23572346 suggestion,
23582347 Applicability :: MachineApplicable ,
23592348 ) ;
23602349
23612350 match category {
23622351 ConstraintCategory :: Return ( _) | ConstraintCategory :: OpaqueType => {
2363- let msg = format ! ( "{} is returned here" , kind ) ;
2352+ let msg = format ! ( "{kind } is returned here" ) ;
23642353 err. span_note ( constraint_span, msg) ;
23652354 }
23662355 ConstraintCategory :: CallArgument ( _) => {
@@ -2402,21 +2391,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
24022391
24032392 err. span_label (
24042393 upvar_span,
2405- format ! ( "`{}` declared here, outside of the {} body" , upvar_name , escapes_from ) ,
2394+ format ! ( "`{upvar_name }` declared here, outside of the {escapes_from } body" ) ,
24062395 ) ;
24072396
2408- err. span_label ( borrow_span, format ! ( "borrow is only valid in the {} body" , escapes_from ) ) ;
2397+ err. span_label ( borrow_span, format ! ( "borrow is only valid in the {escapes_from } body" ) ) ;
24092398
24102399 if let Some ( name) = name {
24112400 err. span_label (
24122401 escape_span,
2413- format ! ( "reference to `{}` escapes the {} body here" , name , escapes_from ) ,
2402+ format ! ( "reference to `{name }` escapes the {escapes_from } body here" ) ,
24142403 ) ;
24152404 } else {
2416- err. span_label (
2417- escape_span,
2418- format ! ( "reference escapes the {} body here" , escapes_from) ,
2419- ) ;
2405+ err. span_label ( escape_span, format ! ( "reference escapes the {escapes_from} body here" ) ) ;
24202406 }
24212407
24222408 err
@@ -2697,10 +2683,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
26972683 } ) ;
26982684 if let Some ( Ok ( instance) ) = deref_target {
26992685 let deref_target_ty = instance. ty ( tcx, self . param_env ) ;
2700- err. note ( format ! (
2701- "borrow occurs due to deref coercion to `{}`" ,
2702- deref_target_ty
2703- ) ) ;
2686+ err. note ( format ! ( "borrow occurs due to deref coercion to `{deref_target_ty}`" ) ) ;
27042687 err. span_note ( tcx. def_span ( instance. def_id ( ) ) , "deref defined here" ) ;
27052688 }
27062689 }
@@ -2756,7 +2739,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
27562739 "cannot assign twice to immutable variable"
27572740 } ;
27582741 if span != assigned_span && !from_arg {
2759- err. span_label ( assigned_span, format ! ( "first assignment to {}" , place_description ) ) ;
2742+ err. span_label ( assigned_span, format ! ( "first assignment to {place_description}" ) ) ;
27602743 }
27612744 if let Some ( decl) = local_decl
27622745 && let Some ( name) = local_name
@@ -2765,7 +2748,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
27652748 err. span_suggestion (
27662749 decl. source_info . span ,
27672750 "consider making this binding mutable" ,
2768- format ! ( "mut {}" , name ) ,
2751+ format ! ( "mut {name}" ) ,
27692752 Applicability :: MachineApplicable ,
27702753 ) ;
27712754 }
@@ -3226,7 +3209,7 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
32263209 return_span,
32273210 } => {
32283211 let argument_ty_name = cx. get_name_for_ty ( argument_ty, 0 ) ;
3229- diag. span_label ( argument_span, format ! ( "has type `{}`" , argument_ty_name ) ) ;
3212+ diag. span_label ( argument_span, format ! ( "has type `{argument_ty_name }`" ) ) ;
32303213
32313214 let return_ty_name = cx. get_name_for_ty ( return_ty, 0 ) ;
32323215 let types_equal = return_ty_name == argument_ty_name;
@@ -3253,15 +3236,14 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
32533236 // Region of return type and arguments checked to be the same earlier.
32543237 let region_name = cx. get_region_name_for_ty ( * return_ty, 0 ) ;
32553238 for ( _, argument_span) in arguments {
3256- diag. span_label ( * argument_span, format ! ( "has lifetime `{}`" , region_name ) ) ;
3239+ diag. span_label ( * argument_span, format ! ( "has lifetime `{region_name }`" ) ) ;
32573240 }
32583241
3259- diag. span_label ( * return_span, format ! ( "also has lifetime `{}`" , region_name , ) ) ;
3242+ diag. span_label ( * return_span, format ! ( "also has lifetime `{region_name }`" , ) ) ;
32603243
32613244 diag. help ( format ! (
3262- "use data from the highlighted arguments which match the `{}` lifetime of \
3245+ "use data from the highlighted arguments which match the `{region_name }` lifetime of \
32633246 the return type",
3264- region_name,
32653247 ) ) ;
32663248
32673249 region_name
0 commit comments