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

rustfmt, clippy #4

Closed
wants to merge 2 commits into from
Closed

rustfmt, clippy #4

wants to merge 2 commits into from

Conversation

dev-ardi
Copy link

Run rustfmt and clippy on the repository

Orion Gonzalez added 2 commits September 30, 2024 16:59
@kornelski
Copy link
Owner

Sorry, I deliberately don't use rustfmt, because it makes too many formatting mistakes and inconsistencies.

@kornelski kornelski closed this Dec 2, 2024
@jayvdb jayvdb mentioned this pull request Dec 4, 2024
@dev-ardi
Copy link
Author

dev-ardi commented Dec 4, 2024

While that's not a bad thing for personal projects I don't think it's a good idea for projects that you expect other people to contribute to.

@kornelski
Copy link
Owner

Code in this project should be well formatted and pretty close to Rust's recommended style, except where rustfmt makes it less readable.

It's unfortunate that Rust doesn't have a formatter as reliable as gofmt. I've added a config file that disables rustfmt, so hopefully even users of editors that run rustfmt unconditionally won't have trouble with it.

@jayvdb
Copy link

jayvdb commented Dec 4, 2024

except where rustfmt makes it less readable.

That is the part that is a bad idea for projects that you expect other people to contribute to.
Because it is you who is the arbiter of what is readable.

rustfmt should be the neutral arbiter of what is readable.

And where it makes mistakes, there are ways to have it skip sections of code https://github.com/rust-lang/rustfmt#tips

I read rust code all day, from lots of projects, and I am very comfortable reading it if it is formatted with rustfmt.
And my IDE automatically provides formatting for me that complies closely to rustfmt. And then I run rustfmt to do the final fixup of formatting.

The code in this project does not closely follow Rust's recommended style.
As as inevitably happens with a code formatter is not used, the code in this project has no defined rules. It has inconsistencies that are arbitrary.

I have started #6 - I am happy to spend time on this to find a rustfmt config that formats the code the way you prefer. Simply point out any part of the diff that you dont like, and I will in good faith attempt to coerce rustfmt to comply to your preferences. It may not always be possible, but we can try, and I will look for existing bugs in rustfmt for anything that doesnt appear to be possible, so we can track them until they are fixed.

@dev-ardi
Copy link
Author

dev-ardi commented Dec 5, 2024

And my IDE automatically provides formatting for me that complies closely to rustfmt. And then I run rustfmt to do the final fixup of formatting.

pro tip: use rustfmt in the ide for formatting ;)

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

Successfully merging this pull request may close these issues.

3 participants