From a2e1cba66b6771d59e74b7cb2375957b2cdfbc68 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Sat, 2 Sep 2023 22:08:56 +0800 Subject: [PATCH] cargo-deny: improve test Currently, in the `test` block, both stable and beta toolchains are installed, while only the beta is used. (The stable toolchain is installed by default during the `rustup-init` invocation.) We can instead ask `rustup-init` to install the beta toolchain directly. In addition, we can choose to use the minimal profile, so that only the necessary components (`rustc`, `rust-std`, and `cargo`) are installed [^1]. (The default profile additionally installs `rust-docs`, `rustfmt`, and `clippy`, but we don't use them in the test.) That should help to cut the test time by half. [^1]: https://rust-lang.github.io/rustup/concepts/profiles.html --- Formula/c/cargo-deny.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Formula/c/cargo-deny.rb b/Formula/c/cargo-deny.rb index a2b69733c2199..a1d68e4d51204 100644 --- a/Formula/c/cargo-deny.rb +++ b/Formula/c/cargo-deny.rb @@ -28,9 +28,9 @@ def install # Show that we can use a different toolchain than the one provided by the `rust` formula. # https://github.com/Homebrew/homebrew-core/pull/134074#pullrequestreview-1484979359 ENV["RUSTUP_INIT_SKIP_PATH_CHECK"] = "yes" - system "#{Formula["rustup-init"].bin}/rustup-init", "-y", "--no-modify-path" + rustup_init = Formula["rustup-init"].bin/"rustup-init" + system rustup_init, "-y", "--profile", "minimal", "--default-toolchain", "beta", "--no-modify-path" ENV.prepend_path "PATH", HOMEBREW_CACHE/"cargo_cache/bin" - system "rustup", "default", "beta" crate = testpath/"demo-crate" mkdir crate do