@@ -3201,14 +3201,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
3201
3201
let expr_ty: Option < Ty < ' _ > > =
3202
3202
visitor. prop_expr . map ( |expr| typeck_results. expr_ty ( expr) . peel_refs ( ) ) ;
3203
3203
3204
- let is_format_arguments_item = if let Some ( expr_ty) = expr_ty
3205
- && let ty:: Adt ( adt, _) = expr_ty. kind ( )
3206
- {
3207
- self . infcx . tcx . is_lang_item ( adt. did ( ) , LangItem :: FormatArguments )
3208
- } else {
3209
- false
3210
- } ;
3211
-
3212
3204
if visitor. found == 0
3213
3205
&& stmt. span . contains ( proper_span)
3214
3206
&& let Some ( p) = sm. span_to_margin ( stmt. span )
@@ -3236,25 +3228,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
3236
3228
""
3237
3229
} ;
3238
3230
3239
- if !is_format_arguments_item {
3240
- let addition = format ! (
3241
- "let {}binding = {};\n {}" ,
3242
- mutability,
3243
- s,
3244
- " " . repeat( p)
3245
- ) ;
3246
- err. multipart_suggestion_verbose (
3247
- msg,
3248
- vec ! [
3249
- ( stmt. span. shrink_to_lo( ) , addition) ,
3250
- ( proper_span, "binding" . to_string( ) ) ,
3251
- ] ,
3252
- Applicability :: MaybeIncorrect ,
3253
- ) ;
3254
- } else {
3255
- err. note ( "the result of `format_args!` can only be assigned directly if no placeholders in its arguments are used" ) ;
3256
- err. note ( "to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html>" ) ;
3257
- }
3231
+ let addition =
3232
+ format ! ( "let {}binding = {};\n {}" , mutability, s, " " . repeat( p) ) ;
3233
+ err. multipart_suggestion_verbose (
3234
+ msg,
3235
+ vec ! [
3236
+ ( stmt. span. shrink_to_lo( ) , addition) ,
3237
+ ( proper_span, "binding" . to_string( ) ) ,
3238
+ ] ,
3239
+ Applicability :: MaybeIncorrect ,
3240
+ ) ;
3241
+
3258
3242
suggested = true ;
3259
3243
break ;
3260
3244
}
0 commit comments