@@ -2045,12 +2045,7 @@ 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
- let lints = parse_unstable_lints (
2049
- toml_config. lints . clone ( ) ,
2050
- & features,
2051
- config,
2052
- & mut warnings,
2053
- ) ?;
2048
+ let lints = parse_unstable_lints ( toml_config. lints . clone ( ) , config, & mut warnings) ?;
2054
2049
let lints = verify_lints ( lints) ?;
2055
2050
inheritable. update_lints ( lints) ;
2056
2051
if let Some ( ws_deps) = & inheritable. dependencies {
@@ -2316,14 +2311,10 @@ impl TomlManifest {
2316
2311
& inherit_cell,
2317
2312
) ?;
2318
2313
2319
- let lints = parse_unstable_lints :: < MaybeWorkspaceLints > (
2320
- me. lints . clone ( ) ,
2321
- & features,
2322
- config,
2323
- cx. warnings ,
2324
- ) ?
2325
- . map ( |mw| mw. resolve ( "lints" , || inherit ( ) ?. lints ( ) ) )
2326
- . transpose ( ) ?;
2314
+ let lints =
2315
+ parse_unstable_lints :: < MaybeWorkspaceLints > ( me. lints . clone ( ) , config, cx. warnings ) ?
2316
+ . map ( |mw| mw. resolve ( "lints" , || inherit ( ) ?. lints ( ) ) )
2317
+ . transpose ( ) ?;
2327
2318
let lints = verify_lints ( lints) ?;
2328
2319
let default = TomlLints :: default ( ) ;
2329
2320
let rustflags = lints_to_rustflags ( lints. as_ref ( ) . unwrap_or ( & default) ) ;
@@ -2757,12 +2748,7 @@ impl TomlManifest {
2757
2748
let mut inheritable = toml_config. package . clone ( ) . unwrap_or_default ( ) ;
2758
2749
inheritable. update_ws_path ( root. to_path_buf ( ) ) ;
2759
2750
inheritable. update_deps ( toml_config. dependencies . clone ( ) ) ;
2760
- let lints = parse_unstable_lints (
2761
- toml_config. lints . clone ( ) ,
2762
- & features,
2763
- config,
2764
- & mut warnings,
2765
- ) ?;
2751
+ let lints = parse_unstable_lints ( toml_config. lints . clone ( ) , config, & mut warnings) ?;
2766
2752
let lints = verify_lints ( lints) ?;
2767
2753
inheritable. update_lints ( lints) ;
2768
2754
let ws_root_config = WorkspaceRootConfig :: new (
@@ -2911,44 +2897,46 @@ impl TomlManifest {
2911
2897
2912
2898
fn parse_unstable_lints < T : Deserialize < ' static > > (
2913
2899
lints : Option < toml:: Value > ,
2914
- features : & Features ,
2915
2900
config : & Config ,
2916
2901
warnings : & mut Vec < String > ,
2917
2902
) -> CargoResult < Option < T > > {
2918
2903
let Some ( lints) = lints else { return Ok ( None ) ; } ;
2919
2904
2920
- if !features . is_enabled ( Feature :: lints ( ) ) {
2921
- warn_for_feature ( "lints" , config, warnings) ;
2905
+ if !config . cli_unstable ( ) . lints {
2906
+ warn_for_lint_feature ( config, warnings) ;
2922
2907
return Ok ( None ) ;
2923
2908
}
2924
2909
2925
2910
lints. try_into ( ) . map ( Some ) . map_err ( |err| err. into ( ) )
2926
2911
}
2927
2912
2928
- fn warn_for_feature ( name : & str , config : & Config , warnings : & mut Vec < String > ) {
2913
+ fn warn_for_lint_feature ( config : & Config , warnings : & mut Vec < String > ) {
2929
2914
use std:: fmt:: Write as _;
2930
2915
2916
+ let key_name = "lints" ;
2917
+ let feature_name = "lints" ;
2918
+
2931
2919
let mut message = String :: new ( ) ;
2932
2920
2933
2921
let _ = write ! (
2934
2922
message,
2935
- "feature `{name }` is not supported on this version of Cargo and will be ignored "
2923
+ "unused manifest key `{key_name }` (may be supported in a future version) "
2936
2924
) ;
2937
2925
if config. nightly_features_allowed {
2938
2926
let _ = write ! (
2939
2927
message,
2940
2928
"
2941
2929
2942
- consider adding `cargo-features = [ \" {name} \" ] ` to the manifest "
2930
+ consider passing `-Z{feature_name} ` to enable this feature. "
2943
2931
) ;
2944
2932
} else {
2945
2933
let _ = write ! (
2946
2934
message,
2947
2935
"
2948
2936
2949
2937
this Cargo does not support nightly features, but if you
2950
- switch to nightly channel you can add
2951
- `cargo-features = [ \" {name} \" ] ` to enable this feature" ,
2938
+ switch to nightly channel you can pass
2939
+ `-Z{feature_name} ` to enable this feature. " ,
2952
2940
) ;
2953
2941
}
2954
2942
warnings. push ( message) ;
0 commit comments