-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add .rustfmt.toml to repo + format code #269
Comments
The other option is to disable rustfmt project-wide with disable_all_formatting in the .rustfmt.toml, though I'd suggest that it's better to pick a suboptimal style rather than ad-hoc style chosen by contributors |
I would PR this, but it would be difficult to review due to the large number of changes, so I'll leave it up to the maintainer to push a version with |
Thanks for your consideration! I've been working on implementing a rustfmt policy that I can stomach. I'm not a fan of autoformatters in general as they tend to make everything look consistently ugly. I'll try to get a PR up in a few more hours. |
Good lord I just noticed rustfmt rewrote everything to lf which conflicts with my windows checkout and usage of autocrlf setting... I'll try to keep going and get the repo to cleanly pass rustfmt but rustfmt is just not ready for actual usage... |
You can adjust this with the newline_style setting. Looks like the default is "auto" though which tries to use whatever that file already uses, so your file probably already had a LF present. |
I can confirm that this is not the case, all files changed by Some git magic later it's all fixed but these are the kind of rough edges that confirm my biases against rustfmt 😛 |
It took some time but it's there |
I'd like to contribute to this project, however it seems like the style is mostly ad-hoc and rustfmt is not being used for the most part?
I propose adding a .rustfmt.toml to the root of the project to ensure that contribution style is consistent, then running
cargo fmt
on the repo to format the code.I've tried to come up with a
.rustfmt.toml
which is minimally imactful while still providing some benefits:Unfortunately this still leads to a large number of changes due to many small adjustments.
More settings can be found here
One other potential issue is the lack of a setting for preserving aligned spaces such as
This patten is found in a few places, especially
src/image.rs
In this case if you want to preserve the nice alignment there are a few options:
#[rustfmt::ignore]
annotations to each line that you want to preserve formatting#[rustfmt::ignore]
#![rustfmt::ignore]
to the top of the file to avoid formatting the whole thingThe text was updated successfully, but these errors were encountered: