Skip to content

Commit 840aff8

Browse files
joshtriplettepage
authored andcommitted
Eliminate the last three "did you mean" warning phrasings
Inspired by #15138 , this eliminates the last three instances. Also rephrase a comment that implied the use of "did you mean" suggestions.
1 parent b10679f commit 840aff8

File tree

6 files changed

+22
-15
lines changed

6 files changed

+22
-15
lines changed

src/cargo/ops/cargo_compile/mod.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,17 @@ pub fn create_bcx<'a, 'gctx>(
230230
match build_config.intent {
231231
UserIntent::Test | UserIntent::Build | UserIntent::Check { .. } | UserIntent::Bench => {
232232
if ws.gctx().get_env("RUST_FLAGS").is_ok() {
233-
gctx.shell().warn(
234-
"Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?",
235-
)?;
233+
gctx.shell()
234+
.warn("ignoring environment variable `RUST_FLAGS`")?;
235+
gctx.shell().note("rust flags are passed via `RUSTFLAGS`")?;
236236
}
237237
}
238238
UserIntent::Doc { .. } | UserIntent::Doctest => {
239239
if ws.gctx().get_env("RUSTDOC_FLAGS").is_ok() {
240-
gctx.shell().warn(
241-
"Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?"
242-
)?;
240+
gctx.shell()
241+
.warn("ignoring environment variable `RUSTDOC_FLAGS`")?;
242+
gctx.shell()
243+
.note("rustdoc flags are passed via `RUSTDOCFLAGS`")?;
243244
}
244245
}
245246
}

src/cargo/sources/registry/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ impl<'gctx> Source for RegistrySource<'gctx> {
846846
// Attempt to handle misspellings by searching for a chain of related
847847
// names to the original name. The resolver will later
848848
// reject any candidates that have the wrong name, and with this it'll
849-
// along the way produce helpful "did you mean?" suggestions.
849+
// have enough information to offer "a similar crate exists" suggestions.
850850
// For now we only try the canonical lysing `-` to `_` and vice versa.
851851
// More advanced fuzzy searching become in the future.
852852
for name_permutation in [

src/cargo/util/toml/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,8 +1747,8 @@ pub fn to_real_manifest(
17471747

17481748
if summary.features().contains_key("default-features") {
17491749
warnings.push(
1750-
"`default-features = [\"..\"]` was found in [features]. \
1751-
Did you mean to use `default = [\"..\"]`?"
1750+
"`[features]` defines a feature named `default-features`
1751+
note: only a feature named `default` will be enabled by default"
17521752
.to_string(),
17531753
)
17541754
}

tests/testsuite/features.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,13 +1851,16 @@ fn warn_if_default_features() {
18511851
.file("bar/src/lib.rs", "pub fn bar() {}")
18521852
.build();
18531853

1854-
p.cargo("check").with_stderr_data(str![[r#"
1855-
[WARNING] `default-features = [".."]` was found in [features]. Did you mean to use `default = [".."]`?
1854+
p.cargo("check")
1855+
.with_stderr_data(str![[r#"
1856+
[WARNING] `[features]` defines a feature named `default-features`
1857+
[NOTE] only a feature named `default` will be enabled by default
18561858
[LOCKING] 1 package to latest compatible version
18571859
[CHECKING] foo v0.0.1 ([ROOT]/foo)
18581860
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
18591861
1860-
"#]]).run();
1862+
"#]])
1863+
.run();
18611864
}
18621865

18631866
#[cargo_test]

tests/testsuite/rustdocflags.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ fn rustdocflags_misspelled() {
115115
p.cargo("doc")
116116
.env("RUSTDOC_FLAGS", "foo")
117117
.with_stderr_data(str![[r#"
118-
[WARNING] Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?
118+
[WARNING] ignoring environment variable `RUSTDOC_FLAGS`
119+
[NOTE] rustdoc flags are passed via `RUSTDOCFLAGS`
119120
...
120121
"#]])
121122
.run();

tests/testsuite/rustflags.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,8 @@ fn env_rustflags_misspelled() {
14431443
.env("RUST_FLAGS", "foo")
14441444
.with_stderr_data(
14451445
"\
1446-
[WARNING] Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?
1446+
[WARNING] ignoring environment variable `RUST_FLAGS`
1447+
[NOTE] rust flags are passed via `RUSTFLAGS`
14471448
...
14481449
",
14491450
)
@@ -1471,7 +1472,8 @@ fn env_rustflags_misspelled_build_script() {
14711472
p.cargo("check")
14721473
.env("RUST_FLAGS", "foo")
14731474
.with_stderr_data(str![[r#"
1474-
[WARNING] Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?
1475+
[WARNING] ignoring environment variable `RUST_FLAGS`
1476+
[NOTE] rust flags are passed via `RUSTFLAGS`
14751477
[COMPILING] foo v0.0.1 ([ROOT]/foo)
14761478
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
14771479

0 commit comments

Comments
 (0)