Skip to content

Commit e421be2

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 8774d07 commit e421be2

File tree

7 files changed

+18
-14
lines changed

7 files changed

+18
-14
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("rust 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/bad_config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3594,7 +3594,8 @@ fn wrong_default_feature_name() {
35943594
.build();
35953595
p.cargo("check")
35963596
.with_stderr_data(str![[r#"
3597-
[WARNING] `default-features = [".."]` was found in [features]. Did you mean to use `default = [".."]`?
3597+
[WARNING] `[features]` defines a feature named `default-features`
3598+
[NOTE] only a feature named `default` will be enabled by default
35983599
[CHECKING] foo v1.0.0 ([ROOT]/foo)
35993600
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
36003601

tests/testsuite/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ fn warn_if_default_features() {
18521852
.build();
18531853

18541854
p.cargo("check").with_stderr_data(str![[r#"
1855-
[WARNING] `default-features = [".."]` was found in [features]. Did you mean to use `default = [".."]`?
1855+
[WARNING] `[features]` defines a feature named `default-features`. Note that only a feature named `default` will be enabled by default.
18561856
[LOCKING] 1 package to latest compatible version
18571857
[CHECKING] foo v0.0.1 ([ROOT]/foo)
18581858
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s

tests/testsuite/rustdocflags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ 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 incorrect environment variable `RUSTDOC_FLAGS`; Rust flags are passed via `RUSTDOCFLAGS`.
119119
...
120120
"#]])
121121
.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)