@@ -1329,40 +1329,88 @@ pub struct SuspiciousDoubleRefCloneDiag<'a> {
1329
1329
}
1330
1330
1331
1331
// non_local_defs.rs
1332
- #[ derive( LintDiagnostic ) ]
1333
1332
pub 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) ]
1339
1333
Impl {
1340
1334
depth : u32 ,
1341
1335
body_kind_descr : & ' static str ,
1342
1336
body_name : String ,
1343
- #[ subdiagnostic]
1344
1337
cargo_update : Option < NonLocalDefinitionsCargoUpdateNote > ,
1345
- #[ suggestion( lint_const_anon, code = "_" , applicability = "machine-applicable" ) ]
1346
1338
const_anon : Option < Span > ,
1347
1339
} ,
1348
- #[ diag( lint_non_local_definitions_macro_rules) ]
1349
1340
MacroRules {
1350
1341
depth : u32 ,
1351
1342
body_kind_descr : & ' static str ,
1352
1343
body_name : String ,
1353
- #[ help]
1354
1344
help : Option < ( ) > ,
1355
- #[ help( lint_help_doctest) ]
1356
1345
doctest_help : Option < ( ) > ,
1357
- #[ note( lint_non_local) ]
1358
- #[ note( lint_exception) ]
1359
- #[ note( lint_non_local_definitions_deprecation) ]
1360
- notes : ( ) ,
1361
- #[ subdiagnostic]
1362
1346
cargo_update : Option < NonLocalDefinitionsCargoUpdateNote > ,
1363
1347
} ,
1364
1348
}
1365
1349
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
+
1366
1414
#[ derive( Subdiagnostic ) ]
1367
1415
#[ note( lint_non_local_definitions_cargo_update) ]
1368
1416
pub struct NonLocalDefinitionsCargoUpdateNote {
0 commit comments