]> git.lizzy.rs Git - rust.git/blobdiff - tests/versioncheck.rs
Auto merge of #9850 - pheki:fix-7499-missing-ref, r=dswij
[rust.git] / tests / versioncheck.rs
index 9e07769a8e4fd8883d4bb98021397dfd76cfea4b..7a85386a3df4b8fc9934fe30010e5f87820fe12d 100644 (file)
@@ -6,7 +6,7 @@
 use std::fs;
 
 #[test]
-fn check_that_clippy_lints_and_clippy_utils_have_the_same_version_as_clippy() {
+fn consistent_clippy_crate_versions() {
     fn read_version(path: &str) -> String {
         let contents = fs::read_to_string(path).unwrap_or_else(|e| panic!("error reading `{path}`: {e:?}"));
         contents
@@ -24,11 +24,16 @@ fn read_version(path: &str) -> String {
     }
 
     let clippy_version = read_version("Cargo.toml");
-    let clippy_lints_version = read_version("clippy_lints/Cargo.toml");
-    let clippy_utils_version = read_version("clippy_utils/Cargo.toml");
 
-    assert_eq!(clippy_version, clippy_lints_version);
-    assert_eq!(clippy_version, clippy_utils_version);
+    let paths = [
+        "declare_clippy_lint/Cargo.toml",
+        "clippy_lints/Cargo.toml",
+        "clippy_utils/Cargo.toml",
+    ];
+
+    for path in paths {
+        assert_eq!(clippy_version, read_version(path), "{path} version differs");
+    }
 }
 
 #[test]
@@ -48,7 +53,7 @@ fn check_that_clippy_has_the_same_major_version_as_rustc() {
     // `RUSTC_REAL` if Clippy is build in the Rust repo with `./x.py`.
     let rustc = std::env::var("RUSTC_REAL").unwrap_or_else(|_| "rustc".to_string());
     let rustc_version = String::from_utf8(
-        std::process::Command::new(&rustc)
+        std::process::Command::new(rustc)
             .arg("--version")
             .output()
             .expect("failed to run `rustc --version`")