Skip to content

Commit 106ca96

Browse files
committed
Use rustc --version in versioncheck
1 parent db268f8 commit 106ca96

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tests/versioncheck.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ fn check_that_clippy_has_the_same_major_version_as_rustc() {
2828
let clippy_minor = clippy_version.minor;
2929
let clippy_patch = clippy_version.patch;
3030

31-
// get the rustc version from cargo
31+
// get the rustc version
3232
// this way the rust-toolchain file version is honored
3333
let rustc_version = String::from_utf8(
34-
std::process::Command::new("cargo")
34+
std::process::Command::new("rustc")
3535
.arg("--version")
3636
.output()
37-
.expect("failed to run 'cargo --version'")
37+
.expect("failed to run `rustc --version`")
3838
.stdout,
3939
)
4040
.unwrap();
41-
// extract "1 50 0" from "cargo 1.50.0-nightly (a3c2627fb 2020-12-14)"
41+
// extract "1 XX 0" from "rustc 1.XX.0-nightly (<commit> <date>)"
4242
let vsplit: Vec<&str> = rustc_version
4343
.split(' ')
4444
.nth(1)
@@ -50,9 +50,7 @@ fn check_that_clippy_has_the_same_major_version_as_rustc() {
5050
.collect();
5151
match vsplit.as_slice() {
5252
[rustc_major, rustc_minor, _rustc_patch] => {
53-
// clippy 0.1.50 should correspond to rustc 1.50.0
54-
dbg!(&rustc_version);
55-
dbg!(&clippy_version);
53+
// clippy 0.1.XX should correspond to rustc 1.XX.0
5654
assert_eq!(clippy_major, 0); // this will probably stay the same for a long time
5755
assert_eq!(
5856
clippy_minor.to_string(),
@@ -68,8 +66,7 @@ fn check_that_clippy_has_the_same_major_version_as_rustc() {
6866
// we don't want our tests failing suddenly
6967
},
7068
_ => {
71-
dbg!(vsplit);
72-
panic!("Failed to parse rustc version");
69+
panic!("Failed to parse rustc version: {:?}", vsplit);
7370
},
7471
};
7572
}

0 commit comments

Comments
 (0)