Skip to content

Commit a6b3486

Browse files
committed
Auto merge of #3698 - sorin-davidoi:fix-common-metadata-no-deps, r=oli-obk
chore(cargo/dependencies/cargo-metadata): Upgrade to 0.7.1 Closes #3692.
2 parents 8a02512 + dc3bee7 commit a6b3486

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ rustc_tools_util = { version = "0.1.1", path = "rustc_tools_util"}
4747

4848
[dev-dependencies]
4949
clippy_dev = { version = "0.0.1", path = "clippy_dev" }
50-
cargo_metadata = "0.6.2"
50+
cargo_metadata = "0.7.1"
5151
compiletest_rs = "0.3.18"
5252
lazy_static = "1.0"
5353
serde_derive = "1.0"

clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ keywords = ["clippy", "lint", "plugin"]
1717
edition = "2018"
1818

1919
[dependencies]
20-
cargo_metadata = "0.6.2"
20+
cargo_metadata = "0.7.1"
2121
itertools = "0.8"
2222
lazy_static = "1.0.2"
2323
matches = "0.1.7"

clippy_lints/src/cargo_common_metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl LintPass for Pass {
6666

6767
impl EarlyLintPass for Pass {
6868
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &Crate) {
69-
let metadata = if let Ok(metadata) = cargo_metadata::metadata_deps(None, true) {
69+
let metadata = if let Ok(metadata) = cargo_metadata::MetadataCommand::new().no_deps().exec() {
7070
metadata
7171
} else {
7272
warning(cx, "could not read cargo metadata");

clippy_lints/src/multiple_crate_versions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl LintPass for Pass {
4141

4242
impl EarlyLintPass for Pass {
4343
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &Crate) {
44-
let metadata = if let Ok(metadata) = cargo_metadata::metadata_deps(None, true) {
44+
let metadata = if let Ok(metadata) = cargo_metadata::MetadataCommand::new().exec() {
4545
metadata
4646
} else {
4747
span_lint(cx, MULTIPLE_CRATE_VERSIONS, DUMMY_SP, "could not read cargo metadata");

clippy_lints/src/wildcard_dependencies.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl LintPass for Pass {
3737

3838
impl EarlyLintPass for Pass {
3939
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &Crate) {
40-
let metadata = if let Ok(metadata) = cargo_metadata::metadata(None) {
40+
let metadata = if let Ok(metadata) = cargo_metadata::MetadataCommand::new().no_deps().exec() {
4141
metadata
4242
} else {
4343
span_lint(cx, WILDCARD_DEPENDENCIES, DUMMY_SP, "could not read cargo metadata");

tests/versioncheck.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
use semver::VersionReq;
2-
31
#[test]
42
fn check_that_clippy_lints_has_the_same_version_as_clippy() {
5-
let clippy_meta = cargo_metadata::metadata(None).expect("could not obtain cargo metadata");
3+
let clippy_meta = cargo_metadata::MetadataCommand::new()
4+
.no_deps()
5+
.exec()
6+
.expect("could not obtain cargo metadata");
67
std::env::set_current_dir(std::env::current_dir().unwrap().join("clippy_lints")).unwrap();
7-
let clippy_lints_meta = cargo_metadata::metadata(None).expect("could not obtain cargo metadata");
8+
let clippy_lints_meta = cargo_metadata::MetadataCommand::new()
9+
.no_deps()
10+
.exec()
11+
.expect("could not obtain cargo metadata");
812
assert_eq!(clippy_lints_meta.packages[0].version, clippy_meta.packages[0].version);
913
for package in &clippy_meta.packages[0].dependencies {
1014
if package.name == "clippy_lints" {
11-
assert_eq!(
12-
VersionReq::parse(&clippy_lints_meta.packages[0].version).unwrap(),
13-
package.req
14-
);
15+
assert!(package.req.matches(&clippy_lints_meta.packages[0].version));
1516
return;
1617
}
1718
}

0 commit comments

Comments
 (0)