@@ -2045,8 +2045,8 @@ impl TomlManifest {
2045
2045
let mut inheritable = toml_config. package . clone ( ) . unwrap_or_default ( ) ;
2046
2046
inheritable. update_ws_path ( package_root. to_path_buf ( ) ) ;
2047
2047
inheritable. update_deps ( toml_config. dependencies . clone ( ) ) ;
2048
- verify_lints ( toml_config. lints . as_ref ( ) , & features) ?;
2049
- inheritable. update_lints ( toml_config . lints . clone ( ) ) ;
2048
+ let lints = verify_lints ( toml_config. lints . clone ( ) , & features, config ) ?;
2049
+ inheritable. update_lints ( lints) ;
2050
2050
if let Some ( ws_deps) = & inheritable. dependencies {
2051
2051
for ( name, dep) in ws_deps {
2052
2052
unused_dep_keys (
@@ -2315,7 +2315,7 @@ impl TomlManifest {
2315
2315
. clone ( )
2316
2316
. map ( |mw| mw. resolve ( "lints" , || inherit ( ) ?. lints ( ) ) )
2317
2317
. transpose ( ) ?;
2318
- verify_lints ( lints. as_ref ( ) , & features) ?;
2318
+ let lints = verify_lints ( lints. clone ( ) , & features, config ) ?;
2319
2319
let default = TomlLints :: default ( ) ;
2320
2320
let mut rustflags = lints
2321
2321
. as_ref ( )
@@ -2773,8 +2773,8 @@ impl TomlManifest {
2773
2773
let mut inheritable = toml_config. package . clone ( ) . unwrap_or_default ( ) ;
2774
2774
inheritable. update_ws_path ( root. to_path_buf ( ) ) ;
2775
2775
inheritable. update_deps ( toml_config. dependencies . clone ( ) ) ;
2776
- verify_lints ( toml_config. lints . as_ref ( ) , & features) ?;
2777
- inheritable. update_lints ( toml_config . lints . clone ( ) ) ;
2776
+ let lints = verify_lints ( toml_config. lints . clone ( ) , & features, config ) ?;
2777
+ inheritable. update_lints ( lints) ;
2778
2778
let ws_root_config = WorkspaceRootConfig :: new (
2779
2779
root,
2780
2780
& toml_config. members ,
@@ -2919,12 +2919,19 @@ impl TomlManifest {
2919
2919
}
2920
2920
}
2921
2921
2922
- fn verify_lints ( lints : Option < & TomlLints > , features : & Features ) -> CargoResult < ( ) > {
2923
- let Some ( lints) = lints else { return Ok ( ( ) ) ; } ;
2922
+ fn verify_lints (
2923
+ lints : Option < TomlLints > ,
2924
+ features : & Features ,
2925
+ config : & Config ,
2926
+ ) -> CargoResult < Option < TomlLints > > {
2927
+ let Some ( lints) = lints else { return Ok ( None ) ; } ;
2924
2928
2925
- features. require ( Feature :: lints ( ) ) ?;
2929
+ if let Err ( err) = features. require ( Feature :: lints ( ) ) {
2930
+ let _ = config. shell ( ) . warn ( err) ;
2931
+ return Ok ( None ) ;
2932
+ }
2926
2933
2927
- for ( tool, lints) in lints {
2934
+ for ( tool, lints) in & lints {
2928
2935
let supported = [ "rust" , "clippy" , "rustdoc" ] ;
2929
2936
if !supported. contains ( & tool. as_str ( ) ) {
2930
2937
let supported = supported. join ( ", " ) ;
@@ -2947,7 +2954,7 @@ fn verify_lints(lints: Option<&TomlLints>, features: &Features) -> CargoResult<(
2947
2954
}
2948
2955
}
2949
2956
2950
- Ok ( ( ) )
2957
+ Ok ( Some ( lints ) )
2951
2958
}
2952
2959
2953
2960
fn unused_dep_keys (
0 commit comments