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
Tracking issue for rustfmt #788
Comments
Usage or non-usage is perversely invasive both upstream and downstream of
|
I think we should probably come up with |
@elichai there are no You can't turn off the agressive code reflowing, because rustfmt works by parsing then reserializing an AST (although you can "trick" it by ending lines with |
Yeah, for those I always use |
ISTR that this annotation doesn't work on 1.29, and you need to use a much uglier one. I guess with the MSRV bump that won't be true anymore? I wouldn't mind sticking |
rustfmt.toml should fix this but I can see it can still break the flow if you forget that a project doesn't use rustfmt. Maybe if we don't use it we could write invalid syntax ("We don't use rustfmt") to that file to force rustfmt to fail instead of accidentally changing things? |
Personally I do not think rustfmt is something that should reasonably be applied to a codebase until at least some substantial readability improvements are made. Probably at a minimum rust-lang/rustfmt#4306 and rust-lang/rustfmt#4146 |
Hmm, I didn't notice the cases you mentioned in |
I totally agree that some things rustfmt does are ugly and annoying but there are some benefits. The question is, I suppose, do the benefits outweigh the costs? Benefits
Costs
|
Id actually argue rustfmt, in its current state, increases my cognitive load and makes me much less likely to spot bugs - the comically vertical layout of rustfmt pushes critical context further away from the code being reviewed, often outside of the diff context displayed in review tools. I couldn't care less about ugly code, I only care about reviewability. |
Compelling point. |
IMO, One of the main benefits of I don't know if @apoelstra remembers this was the reason that
I also get annoyed by |
I have a feeling many post-rustfmt PRs will still have formatting comments, except now its doubly annoying because its "please exempt this code and make it readable" instead of having a chance of doing it reasonably the first time :( |
I agree totally that growing the contributor base is top priority but we should optimize for reviewers/maintainers IMO because their time is the most scarce. |
Note that I haven't had a ton of time to do real review on rust-bitcoin projects in some time, so certainly don't take anything I say too seriously, its just my takes that at least apply to repos where I do have the time to do a lot of review. If people who have more rust-bitcoin time than I feel otherwise, so be it! |
I agree with @TheBlueMatt code style is not causing too much cognitive load. I also don't remember seeing any specifically ugly code by any contributor. For me personally, when contributing to a new project the biggest deciding factor is "can I understand the code and the problem well enough?" Formatting is totally non-issue. What does increase my reviewer cognitive load is seeing things like |
Just wanted to add my 2 sats in favor of using rustfmt. Every code formatter I've ever used has had issues, but they've all still been better than having to manually format code. Additionally, I, like most Rust programmers, have my editor set up to auto format code, and remembering to toggle this off when working on projects that don't use rustfmt is a hassle. |
In my text editor I have a auto-formatting on write set conditional on the presence of |
A large fraction of projects use rustfmt but don't have a |
Yeah, it happens sometimes. When the file is not there, you will just not get auto-formatting so it is not the end of the world, and you can run Submit a PR with an empty file, explain the situation. |
I think the opposite approach is probably better. More projects use rustfmt than don't, so asking projects that don't to go out of there way misplaces the burden. A better approach would be to add a |
Agreed, but that would would first have to be implemented, and my trick personally work for me very well. |
Hey, look at this: https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#disable_all_formatting So I guess |
Oooo, I didn't know about that! That would be awesome. |
ACK putting a rustfmt.toml with I will also put in my two cents, which is that |
This is a massive step forward! PRs created for
Note, |
FTR its |
For those interested in pursuing (or resisting) usage of In parallel I have attempted to come up with a minimal diff to introduce Thanks |
Closing this, rustfmt has been introduced. We still ignore all directories in |
Please not: There is not strong consensus that we should enable rustfmt
This is a tracking issue for pursuing the idea and helping reach consensus.
Previous discussion on rustfmt:
The main blockers to getting consensus
This is likely an organization wide change because it will painful for devs to have to configure their environment differently for different repos in the org?
[1] implies agreeing on a configuration of rustfmt that is acceptable to folks.
The text was updated successfully, but these errors were encountered: