Skip to content
4 changes: 2 additions & 2 deletions src/cargo/util/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl From<TomlLintLevel> for LintLevel {
/// [RFC #3491]: https://rust-lang.github.io/rfcs/3491-remove-implicit-features.html
const IMPLICIT_FEATURES: Lint = Lint {
name: "implicit_features",
desc: "warn about the use of unstable features",
desc: "implicit features for optional dependencies is deprecated and will be unavailable in the 2024 edition",
groups: &[],
default_level: LintLevel::Allow,
edition_lint_opts: Some((Edition::Edition2024, LintLevel::Deny)),
Expand Down Expand Up @@ -192,7 +192,7 @@ pub fn check_implicit_features(
}
let level = lint_level.to_diagnostic_level();
let manifest_path = rel_cwd_manifest_path(path, gctx);
let message = level.title("unused optional dependency").snippet(
let message = level.title(IMPLICIT_FEATURES.desc).snippet(
Snippet::source(manifest.contents())
.origin(&manifest_path)
.annotation(
Expand Down
6 changes: 2 additions & 4 deletions tests/testsuite/lints/implicit_features/edition_2021/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cargo_test_support::prelude::*;
use cargo_test_support::project;
use cargo_test_support::registry::Package;
use cargo_test_support::str;
use cargo_test_support::{file, str};

#[cargo_test]
fn case() {
Expand All @@ -23,12 +23,10 @@ bar = { version = "0.1.0", optional = true }
.build();

snapbox::cmd::Command::cargo_ui()
.masquerade_as_nightly_cargo(&["always_nightly"])
.current_dir(p.root())
.arg("check")
.arg("--quiet")
.assert()
.success()
.stdout_matches(str![""])
.stderr_matches(str![""]);
.stderr_matches(file!["stderr.term.svg"]);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ implicit-features = "warn"
.build();

snapbox::cmd::Command::cargo_ui()
.masquerade_as_nightly_cargo(&["always_nightly"])
.masquerade_as_nightly_cargo(&["cargo-lints"])
.current_dir(p.root())
.arg("check")
.arg("--quiet")
.arg("-Zcargo-lints")
.assert()
.success()
.stdout_matches(str![""])
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ baz = ["dep:baz"]
.build();

snapbox::cmd::Command::cargo_ui()
.masquerade_as_nightly_cargo(&["always_nightly"])
.masquerade_as_nightly_cargo(&["edition2024"])
.current_dir(p.root())
.arg("check")
.assert()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/testsuite/lints/implicit_features/warn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ implicit-features = "warn"
.build();

snapbox::cmd::Command::cargo_ui()
.masquerade_as_nightly_cargo(&["always_nightly"])
.masquerade_as_nightly_cargo(&["cargo-lints", "edition2024"])
.current_dir(p.root())
.arg("check")
.arg("--quiet")
.arg("-Zcargo-lints")
.assert()
.success()
.stdout_matches(str![""])
Expand Down
15 changes: 12 additions & 3 deletions tests/testsuite/lints/implicit_features/warn/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testsuite/lints_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ fn cargo_lints_underscore_supported() {
.masquerade_as_nightly_cargo(&["-Zcargo-lints"])
.with_stderr(
"\
warning: unused optional dependency
warning: implicit features for optional dependencies is deprecated and will be unavailable in the 2024 edition
--> Cargo.toml:12:17
|
12 | bar = { version = \"0.1.0\", optional = true }
Expand Down