Auto merge of #127117 - Urgau:non_local_def-syntactic, r=BoxyUwU · rust-lang/rust@f5cd2c5 (original) (raw)

`@@ -1375,12 +1375,7 @@ pub(crate) enum NonLocalDefinitionsDiag {

`

1375

1375

`body_name: String,

`

1376

1376

`cargo_update: Option,

`

1377

1377

`const_anon: Option<Option>,

`

1378

``

`-

move_to: Option<(Span, Vec)>,

`

1379

1378

`doctest: bool,

`

1380

``

`-

may_remove: Option<(Span, String)>,

`

1381

``

`-

has_trait: bool,

`

1382

``

`-

self_ty_str: String,

`

1383

``

`-

of_trait_str: Option,

`

1384

1379

`macro_to_change: Option<(String, &'static str)>,

`

1385

1380

`},

`

1386

1381

`MacroRules {

`

`@@ -1401,22 +1396,13 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {

`

1401

1396

` body_name,

`

1402

1397

` cargo_update,

`

1403

1398

` const_anon,

`

1404

``

`-

move_to,

`

1405

1399

` doctest,

`

1406

``

`-

may_remove,

`

1407

``

`-

has_trait,

`

1408

``

`-

self_ty_str,

`

1409

``

`-

of_trait_str,

`

1410

1400

` macro_to_change,

`

1411

1401

`} => {

`

1412

1402

` diag.primary_message(fluent::lint_non_local_definitions_impl);

`

1413

1403

` diag.arg("depth", depth);

`

1414

1404

` diag.arg("body_kind_descr", body_kind_descr);

`

1415

1405

` diag.arg("body_name", body_name);

`

1416

``

`-

diag.arg("self_ty_str", self_ty_str);

`

1417

``

`-

if let Some(of_trait_str) = of_trait_str {

`

1418

``

`-

diag.arg("of_trait_str", of_trait_str);

`

1419

``

`-

}

`

1420

1406

``

1421

1407

`if let Some((macro_to_change, macro_kind)) = macro_to_change {

`

1422

1408

` diag.arg("macro_to_change", macro_to_change);

`

`@@ -1427,34 +1413,12 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {

`

1427

1413

` diag.subdiagnostic(cargo_update);

`

1428

1414

`}

`

1429

1415

``

1430

``

`-

if has_trait {

`

1431

``

`-

diag.note(fluent::lint_bounds);

`

1432

``

`-

diag.note(fluent::lint_with_trait);

`

1433

``

`-

} else {

`

1434

``

`-

diag.note(fluent::lint_without_trait);

`

1435

``

`-

}

`

``

1416

`+

diag.note(fluent::lint_non_local);

`

1436

1417

``

1437

``

`-

if let Some((move_help, may_move)) = move_to {

`

1438

``

`-

let mut ms = MultiSpan::from_span(move_help);

`

1439

``

`-

for sp in may_move {

`

1440

``

`-

ms.push_span_label(sp, fluent::lint_non_local_definitions_may_move);

`

1441

``

`-

}

`

1442

``

`-

diag.span_help(ms, fluent::lint_non_local_definitions_impl_move_help);

`

1443

``

`-

}

`

1444

1418

`if doctest {

`

1445

1419

` diag.help(fluent::lint_doctest);

`

1446

1420

`}

`

1447

1421

``

1448

``

`-

if let Some((span, part)) = may_remove {

`

1449

``

`-

diag.arg("may_remove_part", part);

`

1450

``

`-

diag.span_suggestion(

`

1451

``

`-

span,

`

1452

``

`-

fluent::lint_remove_help,

`

1453

``

`-

"",

`

1454

``

`-

Applicability::MaybeIncorrect,

`

1455

``

`-

);

`

1456

``

`-

}

`

1457

``

-

1458

1422

`if let Some(const_anon) = const_anon {

`

1459

1423

` diag.note(fluent::lint_exception);

`

1460

1424

`if let Some(const_anon) = const_anon {

`