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

Cargo version with pre-commit hooks #11960

Closed
wyardley opened this issue Jun 21, 2024 · 2 comments
Closed

Cargo version with pre-commit hooks #11960

wyardley opened this issue Jun 21, 2024 · 2 comments
Labels
question Asking for support or clarification

Comments

@wyardley
Copy link
Contributor

  • List of keywords you searched for before creating this issue. Write them down here so that others can find this issue more easily and help provide feedback.
    “fmt”

From a quick look, the docs don’t seem to mention a specific version of cargo (unless I missed it). The latest version seems to use cargo fix vs cargo fmt which breaks the cargo-fmt pre-commit command unless you skip it.

@MichaReiser
Copy link
Member

By "latest version", do you mean the rust nightly? I just tried running cargo fmt and that runs just fine locally.

We do specify a cargo version in the rust-toolchain.toml which is the version that cargo should pick up by default, unless you have an active override.

@MichaReiser MichaReiser added the question Asking for support or clarification label Jun 21, 2024
@wyardley
Copy link
Contributor Author

Ah, looks like if you install via homebrew, you need to install rustfmt as well.

% cargo --version
cargo 1.79.0
% cargo fmt
error: no such command: `fmt`

	Did you mean `fix`?

	View all installed commands with `cargo --list`
	Find a package to install `fmt` with `cargo search cargo-fmt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for support or clarification
Projects
None yet
Development

No branches or pull requests

2 participants