@@ -403,8 +403,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
403
403
move_prefix : & str ,
404
404
) {
405
405
let message = format ! (
406
- "{}move occurs because {} has type `{}`, which does not implement the `Copy` trait" ,
407
- move_prefix, place_desc, ty,
406
+ "{move_prefix}move occurs because {place_desc} has type `{ty}`, which does not implement the `Copy` trait" ,
408
407
) ;
409
408
if let Some ( span) = span {
410
409
err. span_label ( span, message) ;
@@ -739,11 +738,11 @@ impl<'tcx> BorrowedContentSource<'tcx> {
739
738
BorrowedContentSource :: OverloadedDeref ( ty) => ty
740
739
. ty_adt_def ( )
741
740
. and_then ( |adt| match tcx. get_diagnostic_name ( adt. did ( ) ) ? {
742
- name @ ( sym:: Rc | sym:: Arc ) => Some ( format ! ( "an `{}`" , name ) ) ,
741
+ name @ ( sym:: Rc | sym:: Arc ) => Some ( format ! ( "an `{name }`" ) ) ,
743
742
_ => None ,
744
743
} )
745
- . unwrap_or_else ( || format ! ( "dereference of `{}`" , ty ) ) ,
746
- BorrowedContentSource :: OverloadedIndex ( ty) => format ! ( "index of `{}`" , ty ) ,
744
+ . unwrap_or_else ( || format ! ( "dereference of `{ty }`" ) ) ,
745
+ BorrowedContentSource :: OverloadedIndex ( ty) => format ! ( "index of `{ty }`" ) ,
747
746
}
748
747
}
749
748
@@ -769,11 +768,11 @@ impl<'tcx> BorrowedContentSource<'tcx> {
769
768
BorrowedContentSource :: OverloadedDeref ( ty) => ty
770
769
. ty_adt_def ( )
771
770
. and_then ( |adt| match tcx. get_diagnostic_name ( adt. did ( ) ) ? {
772
- name @ ( sym:: Rc | sym:: Arc ) => Some ( format ! ( "an `{}`" , name ) ) ,
771
+ name @ ( sym:: Rc | sym:: Arc ) => Some ( format ! ( "an `{name }`" ) ) ,
773
772
_ => None ,
774
773
} )
775
- . unwrap_or_else ( || format ! ( "dereference of `{}`" , ty ) ) ,
776
- BorrowedContentSource :: OverloadedIndex ( ty) => format ! ( "an index of `{}`" , ty ) ,
774
+ . unwrap_or_else ( || format ! ( "dereference of `{ty }`" ) ) ,
775
+ BorrowedContentSource :: OverloadedIndex ( ty) => format ! ( "an index of `{ty }`" ) ,
777
776
}
778
777
}
779
778
@@ -1033,7 +1032,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1033
1032
if let UseSpans :: FnSelfUse { var_span, fn_call_span, fn_span, kind } = move_spans {
1034
1033
let place_name = self
1035
1034
. describe_place ( moved_place. as_ref ( ) )
1036
- . map ( |n| format ! ( "`{}`" , n ) )
1035
+ . map ( |n| format ! ( "`{n }`" ) )
1037
1036
. unwrap_or_else ( || "value" . to_owned ( ) ) ;
1038
1037
match kind {
1039
1038
CallKind :: FnCall { fn_trait_id, .. }
@@ -1042,8 +1041,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1042
1041
err. span_label (
1043
1042
fn_call_span,
1044
1043
& format ! (
1045
- "{} {}moved due to this call{}" ,
1046
- place_name, partially_str, loop_message
1044
+ "{place_name} {partially_str}moved due to this call{loop_message}" ,
1047
1045
) ,
1048
1046
) ;
1049
1047
err. span_note (
@@ -1056,8 +1054,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1056
1054
err. span_label (
1057
1055
fn_call_span,
1058
1056
& format ! (
1059
- "{} {}moved due to usage in operator{}" ,
1060
- place_name, partially_str, loop_message
1057
+ "{place_name} {partially_str}moved due to usage in operator{loop_message}" ,
1061
1058
) ,
1062
1059
) ;
1063
1060
if self . fn_self_span_reported . insert ( fn_span) {
@@ -1089,9 +1086,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1089
1086
err. span_suggestion_verbose (
1090
1087
move_span. shrink_to_lo ( ) ,
1091
1088
& format ! (
1092
- "consider iterating over a slice of the `{}`'s content to \
1089
+ "consider iterating over a slice of the `{ty }`'s content to \
1093
1090
avoid moving into the `for` loop",
1094
- ty,
1095
1091
) ,
1096
1092
"&" ,
1097
1093
Applicability :: MaybeIncorrect ,
@@ -1101,8 +1097,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1101
1097
err. span_label (
1102
1098
fn_call_span,
1103
1099
& format ! (
1104
- "{} {}moved due to this implicit call to `.into_iter()`{}" ,
1105
- place_name, partially_str, loop_message
1100
+ "{place_name} {partially_str}moved due to this implicit call to `.into_iter()`{loop_message}" ,
1106
1101
) ,
1107
1102
) ;
1108
1103
// If the moved place was a `&mut` ref, then we can
@@ -1118,7 +1113,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1118
1113
& format ! (
1119
1114
"consider creating a fresh reborrow of {} here" ,
1120
1115
self . describe_place( moved_place. as_ref( ) )
1121
- . map( |n| format!( "`{}`" , n ) )
1116
+ . map( |n| format!( "`{n }`" ) )
1122
1117
. unwrap_or_else( || "the mutable reference" . to_string( ) ) ,
1123
1118
) ,
1124
1119
"&mut *" ,
@@ -1130,8 +1125,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1130
1125
err. span_label (
1131
1126
fn_call_span,
1132
1127
& format ! (
1133
- "{} {}moved due to this method call{}" ,
1134
- place_name, partially_str, loop_message
1128
+ "{place_name} {partially_str}moved due to this method call{loop_message}" ,
1135
1129
) ,
1136
1130
) ;
1137
1131
let infcx = tcx. infer_ctxt ( ) . build ( ) ;
@@ -1206,15 +1200,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1206
1200
if move_span != span || !loop_message. is_empty ( ) {
1207
1201
err. span_label (
1208
1202
move_span,
1209
- format ! ( "value {}moved{} here{}" , partially_str , move_msg , loop_message ) ,
1203
+ format ! ( "value {partially_str }moved{move_msg } here{loop_message}" ) ,
1210
1204
) ;
1211
1205
}
1212
1206
// If the move error occurs due to a loop, don't show
1213
1207
// another message for the same span
1214
1208
if loop_message. is_empty ( ) {
1215
1209
move_spans. var_span_label (
1216
1210
err,
1217
- format ! ( "variable {}moved due to use{}" , partially_str , move_spans. describe( ) ) ,
1211
+ format ! ( "variable {partially_str }moved due to use{}" , move_spans. describe( ) ) ,
1218
1212
"moved" ,
1219
1213
) ;
1220
1214
}
0 commit comments