@@ -1333,40 +1333,95 @@ pub struct SuspiciousDoubleRefCloneDiag<'a> {
13331333}
13341334
13351335// non_local_defs.rs
1336- #[ derive( LintDiagnostic ) ]
13371336pub enum NonLocalDefinitionsDiag {
1338- #[ diag( lint_non_local_definitions_impl) ]
1339- #[ help]
1340- #[ note( lint_non_local) ]
1341- #[ note( lint_exception) ]
1342- #[ note( lint_non_local_definitions_deprecation) ]
13431337 Impl {
13441338 depth : u32 ,
13451339 body_kind_descr : & ' static str ,
13461340 body_name : String ,
1347- #[ subdiagnostic]
13481341 cargo_update : Option < NonLocalDefinitionsCargoUpdateNote > ,
1349- #[ suggestion( lint_const_anon, code = "_" , applicability = "machine-applicable" ) ]
13501342 const_anon : Option < Span > ,
13511343 } ,
1352- #[ diag( lint_non_local_definitions_macro_rules) ]
13531344 MacroRules {
13541345 depth : u32 ,
13551346 body_kind_descr : & ' static str ,
13561347 body_name : String ,
1357- #[ help]
13581348 help : Option < ( ) > ,
1359- #[ help( lint_help_doctest) ]
13601349 doctest_help : Option < ( ) > ,
1361- #[ note( lint_non_local) ]
1362- #[ note( lint_exception) ]
1363- #[ note( lint_non_local_definitions_deprecation) ]
1364- notes : ( ) ,
1365- #[ subdiagnostic]
13661350 cargo_update : Option < NonLocalDefinitionsCargoUpdateNote > ,
13671351 } ,
13681352}
13691353
1354+ impl < ' a > LintDiagnostic < ' a , ( ) > for NonLocalDefinitionsDiag {
1355+ fn decorate_lint < ' b > ( self , diag : & ' b mut Diag < ' a , ( ) > ) {
1356+ match self {
1357+ NonLocalDefinitionsDiag :: Impl {
1358+ depth,
1359+ body_kind_descr,
1360+ body_name,
1361+ cargo_update,
1362+ const_anon,
1363+ } => {
1364+ diag. arg ( "depth" , depth) ;
1365+ diag. arg ( "body_kind_descr" , body_kind_descr) ;
1366+ diag. arg ( "body_name" , body_name) ;
1367+
1368+ diag. help ( fluent:: lint_help) ;
1369+ diag. note ( fluent:: lint_non_local) ;
1370+ diag. note ( fluent:: lint_exception) ;
1371+ diag. note ( fluent:: lint_non_local_definitions_deprecation) ;
1372+
1373+ if let Some ( cargo_update) = cargo_update {
1374+ diag. subdiagnostic ( & diag. dcx , cargo_update) ;
1375+ }
1376+ if let Some ( const_anon) = const_anon {
1377+ diag. span_suggestion (
1378+ const_anon,
1379+ fluent:: lint_const_anon,
1380+ "_" ,
1381+ Applicability :: MachineApplicable ,
1382+ ) ;
1383+ }
1384+ }
1385+ NonLocalDefinitionsDiag :: MacroRules {
1386+ depth,
1387+ body_kind_descr,
1388+ body_name,
1389+ help,
1390+ doctest_help,
1391+ cargo_update,
1392+ } => {
1393+ diag. arg ( "depth" , depth) ;
1394+ diag. arg ( "body_kind_descr" , body_kind_descr) ;
1395+ diag. arg ( "body_name" , body_name) ;
1396+
1397+ if let Some ( ( ) ) = help {
1398+ diag. help ( fluent:: lint_help) ;
1399+ }
1400+ if let Some ( ( ) ) = doctest_help {
1401+ diag. help ( fluent:: lint_help_doctest) ;
1402+ }
1403+
1404+ diag. note ( fluent:: lint_non_local) ;
1405+ diag. note ( fluent:: lint_exception) ;
1406+ diag. note ( fluent:: lint_non_local_definitions_deprecation) ;
1407+
1408+ if let Some ( cargo_update) = cargo_update {
1409+ diag. subdiagnostic ( & diag. dcx , cargo_update) ;
1410+ }
1411+ }
1412+ }
1413+ }
1414+
1415+ fn msg ( & self ) -> DiagMessage {
1416+ match self {
1417+ NonLocalDefinitionsDiag :: Impl { .. } => fluent:: lint_non_local_definitions_impl,
1418+ NonLocalDefinitionsDiag :: MacroRules { .. } => {
1419+ fluent:: lint_non_local_definitions_macro_rules
1420+ }
1421+ }
1422+ }
1423+ }
1424+
13701425#[ derive( Subdiagnostic ) ]
13711426#[ note( lint_non_local_definitions_cargo_update) ]
13721427pub struct NonLocalDefinitionsCargoUpdateNote {
0 commit comments