@@ -3201,14 +3201,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
32013201 let expr_ty: Option < Ty < ' _ > > =
32023202 visitor. prop_expr . map ( |expr| typeck_results. expr_ty ( expr) . peel_refs ( ) ) ;
32033203
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-
32123204 if visitor. found == 0
32133205 && stmt. span . contains ( proper_span)
32143206 && let Some ( p) = sm. span_to_margin ( stmt. span )
@@ -3236,25 +3228,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
32363228 ""
32373229 } ;
32383230
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+
32583242 suggested = true ;
32593243 break ;
32603244 }
0 commit comments