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