Skip to content

Commit 9855e50

Browse files
committed
refactor: Make implicit_features <= edition 2021
1 parent 495f94e commit 9855e50

File tree

6 files changed

+17
-101
lines changed

6 files changed

+17
-101
lines changed

src/cargo/util/lints.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const IMPLICIT_FEATURES: Lint = Lint {
147147
desc: "implicit features for optional dependencies is deprecated and will be unavailable in the 2024 edition",
148148
groups: &[],
149149
default_level: LintLevel::Allow,
150-
edition_lint_opts: Some((Edition::Edition2024, LintLevel::Deny)),
150+
edition_lint_opts: None,
151151
};
152152

153153
pub fn check_implicit_features(
@@ -157,7 +157,14 @@ pub fn check_implicit_features(
157157
error_count: &mut usize,
158158
gctx: &GlobalContext,
159159
) -> CargoResult<()> {
160-
let lint_level = IMPLICIT_FEATURES.level(lints, pkg.manifest().edition());
160+
let edition = pkg.manifest().edition();
161+
// In Edition 2024+, instead of creating optional features, the dependencies are unused.
162+
// See `UNUSED_OPTIONAL_DEPENDENCY`
163+
if edition >= Edition::Edition2024 {
164+
return Ok(());
165+
}
166+
167+
let lint_level = IMPLICIT_FEATURES.level(lints, edition);
161168
if lint_level == LintLevel::Allow {
162169
return Ok(());
163170
}

tests/testsuite/lints/implicit_features/edition_2024/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ baz = ["dep:baz"]
3333
.current_dir(p.root())
3434
.arg("check")
3535
.assert()
36-
.code(101)
36+
.success()
3737
.stdout_matches(str![""])
3838
.stderr_matches(file!["stderr.term.svg"]);
3939
}

tests/testsuite/lints/implicit_features/edition_2024/stderr.term.svg

Lines changed: 7 additions & 12 deletions
Loading
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
mod edition_2021;
22
mod edition_2021_warn;
33
mod edition_2024;
4-
mod warn;

tests/testsuite/lints/implicit_features/warn/mod.rs

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests/testsuite/lints/implicit_features/warn/stderr.term.svg

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)