@@ -2045,8 +2045,8 @@ impl TomlManifest {
20452045 let mut inheritable = toml_config. package . clone ( ) . unwrap_or_default ( ) ;
20462046 inheritable. update_ws_path ( package_root. to_path_buf ( ) ) ;
20472047 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) ;
20502050 if let Some ( ws_deps) = & inheritable. dependencies {
20512051 for ( name, dep) in ws_deps {
20522052 unused_dep_keys (
@@ -2315,7 +2315,7 @@ impl TomlManifest {
23152315 . clone ( )
23162316 . map ( |mw| mw. resolve ( "lints" , || inherit ( ) ?. lints ( ) ) )
23172317 . transpose ( ) ?;
2318- verify_lints ( lints. as_ref ( ) , & features) ?;
2318+ let lints = verify_lints ( lints. clone ( ) , & features, config ) ?;
23192319 let default = TomlLints :: default ( ) ;
23202320 let mut rustflags = lints
23212321 . as_ref ( )
@@ -2773,8 +2773,8 @@ impl TomlManifest {
27732773 let mut inheritable = toml_config. package . clone ( ) . unwrap_or_default ( ) ;
27742774 inheritable. update_ws_path ( root. to_path_buf ( ) ) ;
27752775 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) ;
27782778 let ws_root_config = WorkspaceRootConfig :: new (
27792779 root,
27802780 & toml_config. members ,
@@ -2919,12 +2919,19 @@ impl TomlManifest {
29192919 }
29202920}
29212921
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 ) ; } ;
29242928
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+ }
29262933
2927- for ( tool, lints) in lints {
2934+ for ( tool, lints) in & lints {
29282935 let supported = [ "rust" , "clippy" , "rustdoc" ] ;
29292936 if !supported. contains ( & tool. as_str ( ) ) {
29302937 let supported = supported. join ( ", " ) ;
@@ -2947,7 +2954,7 @@ fn verify_lints(lints: Option<&TomlLints>, features: &Features) -> CargoResult<(
29472954 }
29482955 }
29492956
2950- Ok ( ( ) )
2957+ Ok ( Some ( lints ) )
29512958}
29522959
29532960fn unused_dep_keys (
0 commit comments