@@ -223,7 +223,7 @@ impl<'a> Parser<'a> {
223
223
AssocOp :: NotEqual => "!=" ,
224
224
_ => unreachable ! ( ) ,
225
225
} ;
226
- self . struct_span_err ( sp, & format ! ( "invalid comparison operator `{}=`" , sugg ) )
226
+ self . struct_span_err ( sp, & format ! ( "invalid comparison operator `{sugg }=`" ) )
227
227
. span_suggestion_short (
228
228
sp,
229
229
& format ! ( "`{s}=` is not a valid comparison operator, use `{s}`" , s = sugg) ,
@@ -441,10 +441,10 @@ impl<'a> Parser<'a> {
441
441
442
442
/// Error on `and` and `or` suggesting `&&` and `||` respectively.
443
443
fn error_bad_logical_op ( & self , bad : & str , good : & str , english : & str ) {
444
- self . struct_span_err ( self . token . span , & format ! ( "`{}` is not a logical operator" , bad ) )
444
+ self . struct_span_err ( self . token . span , & format ! ( "`{bad }` is not a logical operator" ) )
445
445
. span_suggestion_short (
446
446
self . token . span ,
447
- & format ! ( "use `{}` to perform logical {}" , good , english ) ,
447
+ & format ! ( "use `{good }` to perform logical {english}" ) ,
448
448
good. to_string ( ) ,
449
449
Applicability :: MachineApplicable ,
450
450
)
@@ -766,9 +766,9 @@ impl<'a> Parser<'a> {
766
766
self . look_ahead ( 1 , |t| t. span ) . to ( span_after_type) ,
767
767
"interpreted as generic arguments" ,
768
768
)
769
- . span_label ( self . token . span , format ! ( "not interpreted as {}" , op_noun ) )
769
+ . span_label ( self . token . span , format ! ( "not interpreted as {op_noun}" ) )
770
770
. multipart_suggestion (
771
- & format ! ( "try {} the cast value" , op_verb ) ,
771
+ & format ! ( "try {op_verb } the cast value" ) ,
772
772
vec ! [
773
773
( expr. span. shrink_to_lo( ) , "(" . to_string( ) ) ,
774
774
( expr. span. shrink_to_hi( ) , ")" . to_string( ) ) ,
@@ -970,7 +970,7 @@ impl<'a> Parser<'a> {
970
970
fn error_unexpected_after_dot ( & self ) {
971
971
// FIXME Could factor this out into non_fatal_unexpected or something.
972
972
let actual = pprust:: token_to_string ( & self . token ) ;
973
- self . struct_span_err ( self . token . span , & format ! ( "unexpected token: `{}`" , actual ) ) . emit ( ) ;
973
+ self . struct_span_err ( self . token . span , & format ! ( "unexpected token: `{actual }`" ) ) . emit ( ) ;
974
974
}
975
975
976
976
// We need an identifier or integer, but the next token is a float.
@@ -1151,15 +1151,15 @@ impl<'a> Parser<'a> {
1151
1151
mem:: replace ( err, replacement_err) . cancel ( ) ;
1152
1152
1153
1153
err. multipart_suggestion (
1154
- & format ! ( "if `{}` is a struct, use braces as delimiters" , name ) ,
1154
+ & format ! ( "if `{name }` is a struct, use braces as delimiters" ) ,
1155
1155
vec ! [
1156
1156
( open_paren, " { " . to_string( ) ) ,
1157
1157
( close_paren, " }" . to_string( ) ) ,
1158
1158
] ,
1159
1159
Applicability :: MaybeIncorrect ,
1160
1160
) ;
1161
1161
err. multipart_suggestion (
1162
- & format ! ( "if `{}` is a function, use the arguments directly" , name ) ,
1162
+ & format ! ( "if `{name }` is a function, use the arguments directly" ) ,
1163
1163
fields
1164
1164
. into_iter ( )
1165
1165
. map ( |field| ( field. span . until ( field. expr . span ) , String :: new ( ) ) )
@@ -1776,9 +1776,9 @@ impl<'a> Parser<'a> {
1776
1776
)
1777
1777
. emit ( ) ;
1778
1778
} else {
1779
- let msg = format ! ( "invalid suffix `{}` for number literal" , suf ) ;
1779
+ let msg = format ! ( "invalid suffix `{suf }` for number literal" ) ;
1780
1780
self . struct_span_err ( span, & msg)
1781
- . span_label ( span, format ! ( "invalid suffix `{}`" , suf ) )
1781
+ . span_label ( span, format ! ( "invalid suffix `{suf }`" ) )
1782
1782
. help ( "the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)" )
1783
1783
. emit ( ) ;
1784
1784
}
@@ -1791,9 +1791,9 @@ impl<'a> Parser<'a> {
1791
1791
let msg = format ! ( "invalid width `{}` for float literal" , & suf[ 1 ..] ) ;
1792
1792
self . struct_span_err ( span, & msg) . help ( "valid widths are 32 and 64" ) . emit ( ) ;
1793
1793
} else {
1794
- let msg = format ! ( "invalid suffix `{}` for float literal" , suf ) ;
1794
+ let msg = format ! ( "invalid suffix `{suf }` for float literal" ) ;
1795
1795
self . struct_span_err ( span, & msg)
1796
- . span_label ( span, format ! ( "invalid suffix `{}`" , suf ) )
1796
+ . span_label ( span, format ! ( "invalid suffix `{suf }`" ) )
1797
1797
. help ( "valid suffixes are `f32` and `f64`" )
1798
1798
. emit ( ) ;
1799
1799
}
@@ -1805,7 +1805,7 @@ impl<'a> Parser<'a> {
1805
1805
2 => "binary" ,
1806
1806
_ => unreachable ! ( ) ,
1807
1807
} ;
1808
- self . struct_span_err ( span, & format ! ( "{} float literal is not supported" , descr ) )
1808
+ self . struct_span_err ( span, & format ! ( "{descr } float literal is not supported" ) )
1809
1809
. span_label ( span, "not supported" )
1810
1810
. emit ( ) ;
1811
1811
}
@@ -1825,7 +1825,7 @@ impl<'a> Parser<'a> {
1825
1825
let mut err = self
1826
1826
. sess
1827
1827
. span_diagnostic
1828
- . struct_span_warn ( sp, & format ! ( "suffixes on {} are invalid" , kind ) ) ;
1828
+ . struct_span_warn ( sp, & format ! ( "suffixes on {kind } are invalid" ) ) ;
1829
1829
err. note ( & format ! (
1830
1830
"`{}` is *temporarily* accepted on tuple index fields as it was \
1831
1831
incorrectly accepted on stable for a few releases",
@@ -1842,10 +1842,10 @@ impl<'a> Parser<'a> {
1842
1842
) ;
1843
1843
err
1844
1844
} else {
1845
- self . struct_span_err ( sp, & format ! ( "suffixes on {} are invalid" , kind ) )
1845
+ self . struct_span_err ( sp, & format ! ( "suffixes on {kind } are invalid" ) )
1846
1846
. forget_guarantee ( )
1847
1847
} ;
1848
- err. span_label ( sp, format ! ( "invalid suffix `{}`" , suf ) ) ;
1848
+ err. span_label ( sp, format ! ( "invalid suffix `{suf }`" ) ) ;
1849
1849
err. emit ( ) ;
1850
1850
}
1851
1851
}
@@ -2211,7 +2211,7 @@ impl<'a> Parser<'a> {
2211
2211
let ctx = if is_ctx_else { "else" } else { "if" } ;
2212
2212
self . struct_span_err ( last, "outer attributes are not allowed on `if` and `else` branches" )
2213
2213
. span_label ( branch_span, "the attributes are attached to this branch" )
2214
- . span_label ( ctx_span, format ! ( "the branch belongs to this `{}`" , ctx ) )
2214
+ . span_label ( ctx_span, format ! ( "the branch belongs to this `{ctx }`" ) )
2215
2215
. span_suggestion (
2216
2216
span,
2217
2217
"remove the attributes" ,
@@ -2391,7 +2391,7 @@ impl<'a> Parser<'a> {
2391
2391
err. span_label ( arrow_span, "while parsing the `match` arm starting here" ) ;
2392
2392
if stmts. len ( ) > 1 {
2393
2393
err. multipart_suggestion (
2394
- & format ! ( "surround the statement{} with a body" , s ) ,
2394
+ & format ! ( "surround the statement{s } with a body" ) ,
2395
2395
vec ! [
2396
2396
( span. shrink_to_lo( ) , "{ " . to_string( ) ) ,
2397
2397
( span. shrink_to_hi( ) , " }" . to_string( ) ) ,
0 commit comments