@@ -1329,40 +1329,88 @@ pub struct SuspiciousDoubleRefCloneDiag<'a> {
13291329}
13301330
13311331// non_local_defs.rs
1332- #[ derive( LintDiagnostic ) ]
13331332pub enum NonLocalDefinitionsDiag {
1334- #[ diag( lint_non_local_definitions_impl) ]
1335- #[ help]
1336- #[ note( lint_non_local) ]
1337- #[ note( lint_exception) ]
1338- #[ note( lint_non_local_definitions_deprecation) ]
13391333 Impl {
13401334 depth : u32 ,
13411335 body_kind_descr : & ' static str ,
13421336 body_name : String ,
1343- #[ subdiagnostic]
13441337 cargo_update : Option < NonLocalDefinitionsCargoUpdateNote > ,
1345- #[ suggestion( lint_const_anon, code = "_" , applicability = "machine-applicable" ) ]
13461338 const_anon : Option < Span > ,
13471339 } ,
1348- #[ diag( lint_non_local_definitions_macro_rules) ]
13491340 MacroRules {
13501341 depth : u32 ,
13511342 body_kind_descr : & ' static str ,
13521343 body_name : String ,
1353- #[ help]
13541344 help : Option < ( ) > ,
1355- #[ help( lint_help_doctest) ]
13561345 doctest_help : Option < ( ) > ,
1357- #[ note( lint_non_local) ]
1358- #[ note( lint_exception) ]
1359- #[ note( lint_non_local_definitions_deprecation) ]
1360- notes : ( ) ,
1361- #[ subdiagnostic]
13621346 cargo_update : Option < NonLocalDefinitionsCargoUpdateNote > ,
13631347 } ,
13641348}
13651349
1350+ impl < ' a > LintDiagnostic < ' a , ( ) > for NonLocalDefinitionsDiag {
1351+ fn decorate_lint < ' b > ( self , diag : & ' b mut Diag < ' a , ( ) > ) {
1352+ match self {
1353+ NonLocalDefinitionsDiag :: Impl {
1354+ depth,
1355+ body_kind_descr,
1356+ body_name,
1357+ cargo_update,
1358+ const_anon,
1359+ } => {
1360+ diag. primary_message ( fluent:: lint_non_local_definitions_impl) ;
1361+ diag. arg ( "depth" , depth) ;
1362+ diag. arg ( "body_kind_descr" , body_kind_descr) ;
1363+ diag. arg ( "body_name" , body_name) ;
1364+
1365+ diag. help ( fluent:: lint_help) ;
1366+ diag. note ( fluent:: lint_non_local) ;
1367+ diag. note ( fluent:: lint_exception) ;
1368+ diag. note ( fluent:: lint_non_local_definitions_deprecation) ;
1369+
1370+ if let Some ( cargo_update) = cargo_update {
1371+ diag. subdiagnostic ( & diag. dcx , cargo_update) ;
1372+ }
1373+ if let Some ( const_anon) = const_anon {
1374+ diag. span_suggestion (
1375+ const_anon,
1376+ fluent:: lint_const_anon,
1377+ "_" ,
1378+ Applicability :: MachineApplicable ,
1379+ ) ;
1380+ }
1381+ }
1382+ NonLocalDefinitionsDiag :: MacroRules {
1383+ depth,
1384+ body_kind_descr,
1385+ body_name,
1386+ help,
1387+ doctest_help,
1388+ cargo_update,
1389+ } => {
1390+ diag. primary_message ( fluent:: lint_non_local_definitions_macro_rules) ;
1391+ diag. arg ( "depth" , depth) ;
1392+ diag. arg ( "body_kind_descr" , body_kind_descr) ;
1393+ diag. arg ( "body_name" , body_name) ;
1394+
1395+ if let Some ( ( ) ) = help {
1396+ diag. help ( fluent:: lint_help) ;
1397+ }
1398+ if let Some ( ( ) ) = doctest_help {
1399+ diag. help ( fluent:: lint_help_doctest) ;
1400+ }
1401+
1402+ diag. note ( fluent:: lint_non_local) ;
1403+ diag. note ( fluent:: lint_exception) ;
1404+ diag. note ( fluent:: lint_non_local_definitions_deprecation) ;
1405+
1406+ if let Some ( cargo_update) = cargo_update {
1407+ diag. subdiagnostic ( & diag. dcx , cargo_update) ;
1408+ }
1409+ }
1410+ }
1411+ }
1412+ }
1413+
13661414#[ derive( Subdiagnostic ) ]
13671415#[ note( lint_non_local_definitions_cargo_update) ]
13681416pub struct NonLocalDefinitionsCargoUpdateNote {
0 commit comments