-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Hassle-free rustfmt setup #155
Comments
We should probably have stuff in our |
As I have worked on the |
For installing the right version of
? |
Should be sufficient. Both |
@alanhdu more like the second approach, though, instead of overrides, you can directly call I don't want to pick a particular blessed rust version, I think it is OK if you, for example, just use the current nightly. For formatting though, it is important to pin the version. |
Status update: we now have Unfortunatelly, we cant' just commit hooks to the repository. |
I know we haven't implemented it yet, are there any restrictions you talking about? |
I think he means that we can't create a commit containing a The precommit hook must be manually installed |
271: Implement format hook r=matklad a=DJMcNab Tentatively: fixes #155. However, this does add all changes in staged files, which might not be desirable. However, I think we can't solve that without explicit support in rustfmt for it, so it should be fine. Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
It would be cool to have all the code formatted with
rustfmt
. The problem is that setting up rustfmt is not-trivial (mainly because you need to know the precise version). I think a (probably slightly over-engineered) solution to this is to addformat
command to tools which shouldThe end goal is that
git clone ... && cd rust-analyzer && cargo format
always works.As a bonus, add
cargo format --instal-hook
, which installs pre-commit hook for reformatting changed files.As an extra bonus, package that as a reusable crate.
The text was updated successfully, but these errors were encountered: