@@ -1340,40 +1340,95 @@ pub struct SuspiciousDoubleRefCloneDiag<'a> {
13401340}
13411341
13421342// non_local_defs.rs
1343- #[ derive( LintDiagnostic ) ]
13441343pub enum NonLocalDefinitionsDiag {
1345- #[ diag( lint_non_local_definitions_impl) ]
1346- #[ help]
1347- #[ note( lint_non_local) ]
1348- #[ note( lint_exception) ]
1349- #[ note( lint_non_local_definitions_deprecation) ]
13501344 Impl {
13511345 depth : u32 ,
13521346 body_kind_descr : & ' static str ,
13531347 body_name : String ,
1354- #[ subdiagnostic]
13551348 cargo_update : Option < NonLocalDefinitionsCargoUpdateNote > ,
1356- #[ suggestion( lint_const_anon, code = "_" , applicability = "machine-applicable" ) ]
13571349 const_anon : Option < Span > ,
13581350 } ,
1359- #[ diag( lint_non_local_definitions_macro_rules) ]
13601351 MacroRules {
13611352 depth : u32 ,
13621353 body_kind_descr : & ' static str ,
13631354 body_name : String ,
1364- #[ help]
13651355 help : Option < ( ) > ,
1366- #[ help( lint_help_doctest) ]
13671356 doctest_help : Option < ( ) > ,
1368- #[ note( lint_non_local) ]
1369- #[ note( lint_exception) ]
1370- #[ note( lint_non_local_definitions_deprecation) ]
1371- notes : ( ) ,
1372- #[ subdiagnostic]
13731357 cargo_update : Option < NonLocalDefinitionsCargoUpdateNote > ,
13741358 } ,
13751359}
13761360
1361+ impl < ' a > LintDiagnostic < ' a , ( ) > for NonLocalDefinitionsDiag {
1362+ fn decorate_lint < ' b > ( self , diag : & ' b mut Diag < ' a , ( ) > ) {
1363+ match self {
1364+ NonLocalDefinitionsDiag :: Impl {
1365+ depth,
1366+ body_kind_descr,
1367+ body_name,
1368+ cargo_update,
1369+ const_anon,
1370+ } => {
1371+ diag. arg ( "depth" , depth) ;
1372+ diag. arg ( "body_kind_descr" , body_kind_descr) ;
1373+ diag. arg ( "body_name" , body_name) ;
1374+
1375+ diag. help ( fluent:: lint_help) ;
1376+ diag. note ( fluent:: lint_non_local) ;
1377+ diag. note ( fluent:: lint_exception) ;
1378+ diag. note ( fluent:: lint_non_local_definitions_deprecation) ;
1379+
1380+ if let Some ( cargo_update) = cargo_update {
1381+ diag. subdiagnostic ( & diag. dcx , cargo_update) ;
1382+ }
1383+ if let Some ( const_anon) = const_anon {
1384+ diag. span_suggestion (
1385+ const_anon,
1386+ fluent:: lint_const_anon,
1387+ "_" ,
1388+ Applicability :: MachineApplicable ,
1389+ ) ;
1390+ }
1391+ }
1392+ NonLocalDefinitionsDiag :: MacroRules {
1393+ depth,
1394+ body_kind_descr,
1395+ body_name,
1396+ help,
1397+ doctest_help,
1398+ cargo_update,
1399+ } => {
1400+ diag. arg ( "depth" , depth) ;
1401+ diag. arg ( "body_kind_descr" , body_kind_descr) ;
1402+ diag. arg ( "body_name" , body_name) ;
1403+
1404+ if let Some ( ( ) ) = help {
1405+ diag. help ( fluent:: lint_help) ;
1406+ }
1407+ if let Some ( ( ) ) = doctest_help {
1408+ diag. help ( fluent:: lint_help_doctest) ;
1409+ }
1410+
1411+ diag. note ( fluent:: lint_non_local) ;
1412+ diag. note ( fluent:: lint_exception) ;
1413+ diag. note ( fluent:: lint_non_local_definitions_deprecation) ;
1414+
1415+ if let Some ( cargo_update) = cargo_update {
1416+ diag. subdiagnostic ( & diag. dcx , cargo_update) ;
1417+ }
1418+ }
1419+ }
1420+ }
1421+
1422+ fn msg ( & self ) -> DiagMessage {
1423+ match self {
1424+ NonLocalDefinitionsDiag :: Impl { .. } => fluent:: lint_non_local_definitions_impl,
1425+ NonLocalDefinitionsDiag :: MacroRules { .. } => {
1426+ fluent:: lint_non_local_definitions_macro_rules
1427+ }
1428+ }
1429+ }
1430+ }
1431+
13771432#[ derive( Subdiagnostic ) ]
13781433#[ note( lint_non_local_definitions_cargo_update) ]
13791434pub struct NonLocalDefinitionsCargoUpdateNote {
0 commit comments