@@ -223,7 +223,7 @@ impl<'a> Parser<'a> {
223223 AssocOp :: NotEqual => "!=" ,
224224 _ => unreachable ! ( ) ,
225225 } ;
226- self . struct_span_err ( sp, & format ! ( "invalid comparison operator `{}=`" , sugg ) )
226+ self . struct_span_err ( sp, & format ! ( "invalid comparison operator `{sugg }=`" ) )
227227 . span_suggestion_short (
228228 sp,
229229 & format ! ( "`{s}=` is not a valid comparison operator, use `{s}`" , s = sugg) ,
@@ -441,10 +441,10 @@ impl<'a> Parser<'a> {
441441
442442 /// Error on `and` and `or` suggesting `&&` and `||` respectively.
443443 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" ) )
445445 . span_suggestion_short (
446446 self . token . span ,
447- & format ! ( "use `{}` to perform logical {}" , good , english ) ,
447+ & format ! ( "use `{good }` to perform logical {english}" ) ,
448448 good. to_string ( ) ,
449449 Applicability :: MachineApplicable ,
450450 )
@@ -766,9 +766,9 @@ impl<'a> Parser<'a> {
766766 self . look_ahead ( 1 , |t| t. span ) . to ( span_after_type) ,
767767 "interpreted as generic arguments" ,
768768 )
769- . span_label ( self . token . span , format ! ( "not interpreted as {}" , op_noun ) )
769+ . span_label ( self . token . span , format ! ( "not interpreted as {op_noun}" ) )
770770 . multipart_suggestion (
771- & format ! ( "try {} the cast value" , op_verb ) ,
771+ & format ! ( "try {op_verb } the cast value" ) ,
772772 vec ! [
773773 ( expr. span. shrink_to_lo( ) , "(" . to_string( ) ) ,
774774 ( expr. span. shrink_to_hi( ) , ")" . to_string( ) ) ,
@@ -970,7 +970,7 @@ impl<'a> Parser<'a> {
970970 fn error_unexpected_after_dot ( & self ) {
971971 // FIXME Could factor this out into non_fatal_unexpected or something.
972972 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 ( ) ;
974974 }
975975
976976 // We need an identifier or integer, but the next token is a float.
@@ -1151,15 +1151,15 @@ impl<'a> Parser<'a> {
11511151 mem:: replace ( err, replacement_err) . cancel ( ) ;
11521152
11531153 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" ) ,
11551155 vec ! [
11561156 ( open_paren, " { " . to_string( ) ) ,
11571157 ( close_paren, " }" . to_string( ) ) ,
11581158 ] ,
11591159 Applicability :: MaybeIncorrect ,
11601160 ) ;
11611161 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" ) ,
11631163 fields
11641164 . into_iter ( )
11651165 . map ( |field| ( field. span . until ( field. expr . span ) , String :: new ( ) ) )
@@ -1776,9 +1776,9 @@ impl<'a> Parser<'a> {
17761776 )
17771777 . emit ( ) ;
17781778 } else {
1779- let msg = format ! ( "invalid suffix `{}` for number literal" , suf ) ;
1779+ let msg = format ! ( "invalid suffix `{suf }` for number literal" ) ;
17801780 self . struct_span_err ( span, & msg)
1781- . span_label ( span, format ! ( "invalid suffix `{}`" , suf ) )
1781+ . span_label ( span, format ! ( "invalid suffix `{suf }`" ) )
17821782 . help ( "the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)" )
17831783 . emit ( ) ;
17841784 }
@@ -1791,9 +1791,9 @@ impl<'a> Parser<'a> {
17911791 let msg = format ! ( "invalid width `{}` for float literal" , & suf[ 1 ..] ) ;
17921792 self . struct_span_err ( span, & msg) . help ( "valid widths are 32 and 64" ) . emit ( ) ;
17931793 } else {
1794- let msg = format ! ( "invalid suffix `{}` for float literal" , suf ) ;
1794+ let msg = format ! ( "invalid suffix `{suf }` for float literal" ) ;
17951795 self . struct_span_err ( span, & msg)
1796- . span_label ( span, format ! ( "invalid suffix `{}`" , suf ) )
1796+ . span_label ( span, format ! ( "invalid suffix `{suf }`" ) )
17971797 . help ( "valid suffixes are `f32` and `f64`" )
17981798 . emit ( ) ;
17991799 }
@@ -1805,7 +1805,7 @@ impl<'a> Parser<'a> {
18051805 2 => "binary" ,
18061806 _ => unreachable ! ( ) ,
18071807 } ;
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" ) )
18091809 . span_label ( span, "not supported" )
18101810 . emit ( ) ;
18111811 }
@@ -1825,7 +1825,7 @@ impl<'a> Parser<'a> {
18251825 let mut err = self
18261826 . sess
18271827 . span_diagnostic
1828- . struct_span_warn ( sp, & format ! ( "suffixes on {} are invalid" , kind ) ) ;
1828+ . struct_span_warn ( sp, & format ! ( "suffixes on {kind } are invalid" ) ) ;
18291829 err. note ( & format ! (
18301830 "`{}` is *temporarily* accepted on tuple index fields as it was \
18311831 incorrectly accepted on stable for a few releases",
@@ -1842,10 +1842,10 @@ impl<'a> Parser<'a> {
18421842 ) ;
18431843 err
18441844 } 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" ) )
18461846 . forget_guarantee ( )
18471847 } ;
1848- err. span_label ( sp, format ! ( "invalid suffix `{}`" , suf ) ) ;
1848+ err. span_label ( sp, format ! ( "invalid suffix `{suf }`" ) ) ;
18491849 err. emit ( ) ;
18501850 }
18511851 }
@@ -2211,7 +2211,7 @@ impl<'a> Parser<'a> {
22112211 let ctx = if is_ctx_else { "else" } else { "if" } ;
22122212 self . struct_span_err ( last, "outer attributes are not allowed on `if` and `else` branches" )
22132213 . 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 }`" ) )
22152215 . span_suggestion (
22162216 span,
22172217 "remove the attributes" ,
@@ -2391,7 +2391,7 @@ impl<'a> Parser<'a> {
23912391 err. span_label ( arrow_span, "while parsing the `match` arm starting here" ) ;
23922392 if stmts. len ( ) > 1 {
23932393 err. multipart_suggestion (
2394- & format ! ( "surround the statement{} with a body" , s ) ,
2394+ & format ! ( "surround the statement{s } with a body" ) ,
23952395 vec ! [
23962396 ( span. shrink_to_lo( ) , "{ " . to_string( ) ) ,
23972397 ( span. shrink_to_hi( ) , " }" . to_string( ) ) ,
0 commit comments