Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustfmt 1.5.2 #121441

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Formula/rustfmt.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class Rustfmt < Formula
desc "Format Rust code"
homepage "https://rust-lang.github.io/rustfmt/"
url "https://github.com/rust-lang/rustfmt/archive/refs/tags/v1.5.1.tar.gz"
sha256 "dc29a1c066fe4816e1400655c676d632335d667c3b0231ce344b2a7b02acc267"
url "https://github.com/rust-lang/rustfmt/archive/refs/tags/v1.5.2.tar.gz"
sha256 "73a319d7603e3839c1319777af34b0bb0393bc5a73dcb4e4a02470e4218cb238"
license any_of: ["MIT", "Apache-2.0"]
head "https://github.com/rust-lang/rustfmt.git", branch: "master"

Expand All @@ -25,8 +25,8 @@ def install
system "#{Formula["rustup-init"].bin}/rustup-init", "-qy", "--no-modify-path"
ENV.prepend_path "PATH", HOMEBREW_CACHE/"cargo_cache/bin"
# we are using nightly because rustfmt requires nightly in order to build from source
# pinning to nightly-2021-11-08 to avoid inconstency
nightly_version = "nightly-2021-11-08"
# pinning to nightly-2023-01-24 to avoid inconstency
nightly_version = "nightly-2023-01-24"
Comment on lines +28 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can just read this from the rust-toolchain file so that this doesn't have to be updated manually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note rustup's cargo already reads the version from that file, so unless we want to be explicit all we need is

    system "#{Formula["rustup-init"].bin}/rustup-init", "-qy", "--no-modify-path"
    ENV.prepend_path "PATH", HOMEBREW_CACHE/"cargo_cache/bin"
    system "cargo", "install", *std_cargo_args
Example

==> cargo install --locked --root /opt/homebrew/Cellar/rustfmt/1.5.2 --path .
info: syncing channel updates for 'nightly-2023-01-24-aarch64-apple-darwin'
info: latest update on 2023-01-24, rust version 1.69.0-nightly (c8e6a9e8b 2023-01-23)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'llvm-tools'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustc-dev'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'llvm-tools'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustc-dev'
info: installing component 'rustfmt'
  Installing rustfmt-nightly v1.5.2 (/private/tmp/rustfmt-20230126-48518-ucx7qv/rustfmt-1.5.2)
...

components = %w[rust-src rustc-dev llvm-tools-preview]
system "rustup", "toolchain", "install", nightly_version
system "rustup", "component", "add", *components, "--toolchain", nightly_version
Expand Down