@@ -242,6 +242,8 @@ pub struct TomlManifest {
242
242
workspace : Option < TomlWorkspace > ,
243
243
badges : Option < BTreeMap < String , BTreeMap < String , String > > > ,
244
244
lints : Option < BTreeMap < String , String > > ,
245
+ #[ serde( rename = "lints2" ) ]
246
+ feature_lints : Option < BTreeMap < String , BTreeMap < String , String > > > ,
245
247
}
246
248
247
249
#[ derive( Deserialize , Serialize , Clone , Debug , Default ) ]
@@ -751,6 +753,7 @@ impl TomlManifest {
751
753
badges : self . badges . clone ( ) ,
752
754
cargo_features : self . cargo_features . clone ( ) ,
753
755
lints : self . lints . clone ( ) ,
756
+ feature_lints : self . feature_lints . clone ( ) ,
754
757
} ) ;
755
758
756
759
fn map_deps (
@@ -1000,7 +1003,7 @@ impl TomlManifest {
1000
1003
) ,
1001
1004
} ;
1002
1005
let profiles = Profiles :: new ( me. profile . as_ref ( ) , config, & features, & mut warnings) ?;
1003
- let lints = Lints :: new ( me. lints . as_ref ( ) , & mut warnings) ?;
1006
+ let lints = lints ( me. lints . as_ref ( ) , me . feature_lints . as_ref ( ) , & mut warnings) ?;
1004
1007
let publish = match project. publish {
1005
1008
Some ( VecStringOrBool :: VecString ( ref vecstring) ) => {
1006
1009
features
@@ -1114,7 +1117,7 @@ impl TomlManifest {
1114
1117
( me. replace ( & mut cx) ?, me. patch ( & mut cx) ?)
1115
1118
} ;
1116
1119
let profiles = Profiles :: new ( me. profile . as_ref ( ) , config, & features, & mut warnings) ?;
1117
- let lints = Lints :: new ( me. lints . as_ref ( ) , & mut warnings) ?;
1120
+ let lints = lints ( me. lints . as_ref ( ) , me . feature_lints . as_ref ( ) , & mut warnings) ?;
1118
1121
let workspace_config = match me. workspace {
1119
1122
Some ( ref config) => WorkspaceConfig :: Root ( WorkspaceRootConfig :: new (
1120
1123
& root,
@@ -1495,3 +1498,24 @@ impl fmt::Debug for PathValue {
1495
1498
self . 0 . fmt ( f)
1496
1499
}
1497
1500
}
1501
+
1502
+ fn lints (
1503
+ toml_lints : Option < & BTreeMap < String , String > > ,
1504
+ toml_feature_lints : Option < & BTreeMap < String , BTreeMap < String , String > > > ,
1505
+ warnings : & mut Vec < String >
1506
+ ) -> CargoResult < Option < Vec < Lints > > > {
1507
+ let mut lints = vec ! [ ] ;
1508
+ if let Some ( toml_lints) = toml_lints {
1509
+ lints. push ( Lints :: new ( None , toml_lints, warnings) ?) ;
1510
+ }
1511
+ if let Some ( toml_feature_lints) = toml_feature_lints {
1512
+ for ( ref cfg, ref feature_lints) in toml_feature_lints. iter ( ) {
1513
+ lints. push ( Lints :: new ( Some ( cfg) , feature_lints, warnings) ?) ;
1514
+ }
1515
+ }
1516
+ Ok ( if !lints. is_empty ( ) {
1517
+ Some ( lints)
1518
+ } else {
1519
+ None
1520
+ } )
1521
+ }
0 commit comments