Skip to content

Commit c56349f

Browse files
committed
Revert warning on version = …
1 parent 120bea7 commit c56349f

File tree

2 files changed

+12
-29
lines changed

2 files changed

+12
-29
lines changed

crates/cargo-platform/src/lib.rs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,14 @@ impl Platform {
8888
)),
8989
_ => (),
9090
},
91-
Cfg::KeyPair(name, _) => match name.as_str() {
92-
"feature" => {
93-
warnings.push(String::from(
94-
"Found `feature = ...` in `target.'cfg(...)'.dependencies`. \
95-
This key is not supported for selecting dependencies \
96-
and will not work as expected. \
97-
Use the [features] section instead: \
98-
https://doc.rust-lang.org/cargo/reference/features.html"
99-
));
100-
},
101-
"version" => {
102-
warnings.push(String::from(
103-
"Found `version = ...` in `target.'cfg(...)'.dependencies`. \
104-
This format is ignored by Cargo. \
105-
Use the format `version(\"1.23.4\")` or `version(\"1.23\")` instead."
106-
));
107-
},
108-
_ => {}
91+
Cfg::KeyPair(name, _) => if name.as_str() == "feature" {
92+
warnings.push(String::from(
93+
"Found `feature = ...` in `target.'cfg(...)'.dependencies`. \
94+
This key is not supported for selecting dependencies \
95+
and will not work as expected. \
96+
Use the [features] section instead: \
97+
https://doc.rust-lang.org/cargo/reference/features.html"
98+
))
10999
},
110100
Cfg::Version(..) => {},
111101
}

tests/testsuite/cfg.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -944,17 +944,10 @@ fn cfg_bad_version3() {
944944
p.cargo("check")
945945
.with_status(101)
946946
.with_stderr_data(str![[r#"
947-
[WARNING] Found `version = ...` in `target.'cfg(...)'.dependencies`. This format is ignored by Cargo. Use the format `version("1.23.4")` or `version("1.23")` instead.
948-
[LOCKING] 1 package to latest compatible version
949-
[CHECKING] foo v0.0.0 ([ROOT]/foo)
950-
error[E0463]: can't find crate for `b`
951-
--> src/lib.rs:1:1
952-
|
953-
1 | extern crate b;
954-
| ^^^^^^^^^^^^^^^ can't find crate
955-
956-
For more information about this error, try `rustc --explain E0463`.
957-
[ERROR] could not compile `foo` (lib) due to 1 previous error
947+
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
948+
949+
Caused by:
950+
failed to parse `version = "1.87.0"` as a cfg expression: expected `(`, found `=`
958951
959952
"#]])
960953
.run();

0 commit comments

Comments
 (0)