diff --git a/Cargo.lock b/Cargo.lock index e05defae..3f3ef60e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -374,6 +374,7 @@ version = "0.1.0" dependencies = [ "assert_cmd", "ctor", + "elaborate", "regex", "serde_json", "similar-asserts", @@ -820,9 +821,9 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "elaborate" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be532131e43b399e289765d3a429fc6422f62b14c1cfcb784635053c188c9d1" +checksum = "d4cecb9e27c0610eceefaf4466e4b382a43c79dd5af61595e22412848b5cca41" dependencies = [ "anyhow", ] diff --git a/Cargo.toml b/Cargo.toml index fe8e201a..17822eca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ clap = { version = "4.5", features = ["cargo", "derive", "wrap_help"] } crates-index = { version = "3.11", features = ["git-https-reqwest"] } crates_io_api = "0.12.0" curl = "0.4" -elaborate = "0.1" +elaborate = "0.2" env_logger = "0.11" home = "0.5" log = "0.4" @@ -42,7 +42,7 @@ testing = { path = "testing" } tokio = "1.48" [build-dependencies] -elaborate = "0.1" +elaborate = "0.2" [features] default = ["on-disk-cache", "lock-index"] diff --git a/ci/Cargo.toml b/ci/Cargo.toml index 9397622a..8bdb334e 100644 --- a/ci/Cargo.toml +++ b/ci/Cargo.toml @@ -7,6 +7,7 @@ publish = false [dev-dependencies] assert_cmd = "2.1" ctor = "0.6" +elaborate = "0.2" regex = "1.12" serde_json = "1.0" similar-asserts = "1.7" diff --git a/ci/src/lib.rs b/ci/src/lib.rs index 1d6e507f..126f8a0b 100644 --- a/ci/src/lib.rs +++ b/ci/src/lib.rs @@ -24,6 +24,24 @@ fn initialize() { set_current_dir(".."); } +#[test] +fn clippy() { + Command::new("cargo") + // smoelius: Remove `CARGO` environment variable to work around: + // https://github.com/rust-lang/rust/pull/131729 + .env_remove("CARGO") + .args([ + "+nightly", + "clippy", + "--all-features", + "--all-targets", + "--", + "--deny=warnings", + ]) + .assert() + .success(); +} + #[test] fn dylint() { let assert = Command::new("cargo") @@ -34,6 +52,15 @@ fn dylint() { assert!(assert.try_success().is_ok(), "{}", stderr); } +#[test] +fn elaborate_disallowed_methods() { + elaborate::disallowed_methods() + .args(["--all-features", "--all-targets"]) + .env("RUSTUP_TOOLCHAIN", "nightly") + .assert() + .success(); +} + #[test] fn fmt() { Command::new("rustup") diff --git a/mock_github/Cargo.lock b/mock_github/Cargo.lock index 01b2c0f9..62590d88 100644 --- a/mock_github/Cargo.lock +++ b/mock_github/Cargo.lock @@ -518,9 +518,9 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "elaborate" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be532131e43b399e289765d3a429fc6422f62b14c1cfcb784635053c188c9d1" +checksum = "d4cecb9e27c0610eceefaf4466e4b382a43c79dd5af61595e22412848b5cca41" dependencies = [ "anyhow", ] diff --git a/testing/Cargo.toml b/testing/Cargo.toml index a74f4841..59a1898d 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] anyhow = "1.0" -elaborate = "0.1" +elaborate = "0.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" snapbox = "0.6" diff --git a/tests/clippy.rs b/tests/clippy.rs deleted file mode 100644 index 2b0719b5..00000000 --- a/tests/clippy.rs +++ /dev/null @@ -1,18 +0,0 @@ -#[test] -fn clippy() { - for disallow_elaborate_methods in [false, true] { - let mut command = assert_cmd::Command::new("cargo"); - command.args([ - "+nightly", - "clippy", - "--all-features", - "--all-targets", - "--", - "--deny=warnings", - ]); - if disallow_elaborate_methods { - command.env("CLIPPY_CONF_DIR", "assets/elaborate"); - } - command.assert().success(); - } -}