-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Clarify internal programming style #49567
Comments
The intention has always been that, when
Generally, discussions are best had on https://internals.rust-lang.org/ rather than the issue tracker; I'll leave @rust-lang/compiler to decide if this should be moved there, though. |
In this case, it would seem sensible to discourage "Run rustfmt on [X]"-style PRs in general.
Ah, that's true. I was thinking of it more as a "contribution documentation" omission (i.e. that this should be made clearer somewhere in the repository), but more nuanced discussions (if anyone would be opposed to stating that these kinds of PRs are discouraged until |
Historically, this has been helpful to point out issues in
Yes, this is exactly why I didn't close it; if the team wants to document some kind of policy, this is totally a bug, but if there's more disagreement about the policy than I'm aware of (as I'm not on the team) and it needs to be discussed before documenting it, then it'd better be on internals. We'll see! |
Cargo recently attempted this, but just today it was disabled (rust-lang/cargo#5278). It can cause friction with PRs since most people aren't used to running rustfmt all the time. |
Clippy tried it a while back, but we disabled it out of the same reason that cargo did so. Options that I see:
|
We might also be able to solve this on the rustfmt side by pinning to a version number. |
At this stage I think that rustfmt formatting is stable enough that re-formatting crates is unlikely to cause much churn, therefore it is fine to land formatting PRs. However, I wouldn't go so far as to encourage it because reviewing and landing them can be a pain. |
Closing in favor of discussing on internals |
Every so often someone will submit a pull request that is the result of running
rustfmt
on a particular file, or set of files (examples: #49360, #38567, #30684).Presumably we want to encourage fixing mistakes in the code style, though at the moment
rustfmt
can produce undesirable changes (e.g. see the comments in #37349). Without guidelines, these can either be merged directly, or it left up to the individual reviewer to decide which changes are preferred.It seems to me it would be better to do one of two things:
rustfmt
totidy
and ensure code always adheres to one style.rustfmt
is too strict or not good enough). I.e. not changing style choices that were the original intention of the author if they're not specified by the style guide.At the moment, I think style changes are being made, through blind use of
rustfmt
, that leave the code in a worse state than before. I think it'd be preferable if we could avoid this; does anyone else have thoughts?The text was updated successfully, but these errors were encountered: