-
Notifications
You must be signed in to change notification settings - Fork 649
Run rustfmt on the whole codebase and send in the changes #574
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
Comments
1 PR for each change that rustfmt suggests, 1 per file, or a global one ? |
I think one PR with one commit that makes all the changes that rustfmt suggests in all the files is probably the easiest thing, although I haven't worked with rustfmt much. Is there an easy way to turn off all suggestions, then turn them on one at a time and make one commit per type of suggestion? That might be slightly easier to review, and would make it easier to see what caused any test failures (by using Wdyt? |
I happened to be looking at this one at the same time @Insomgla first commented. rustfmt can automatically fix all but 2 mis-formattings in the project. Of those two it can't fix, one involves renaming a function call to get under a 100 character line count (this one if memory serves https://github.com/rust-lang/crates.io/blob/master/src/db.rs#L61) but I'm not sure that can be fixed because the function is from the OpenSSL crate (https://github.com/sfackler/rust-openssl/blob/master/openssl/src/ssl/connector.rs#L112) and the other seemed to be a bug in rustfmt which couldn't correct a trailing whitespace mis-format, yet if it was corrected manually then rustfmt would add the whitespace back in and show an error again. It was late so I didn't look into it too closely and could be wrong though. All that to say that my suggestion, FWIW, would be 1 PR with 1 commit for the auto-fixes then 1 commit per manual fix as they are not of the same kind. |
@elliotekj I fixed the second misformatting by removing the comment. As for the first one, I agree, we can't do much, except if Rust allowed to split function names :) |
It seems rustfmt has a skip attribute (https://github.com/rust-lang-nursery/rustfmt/blob/master/tests/target/skip.rs). As the call can't be renamed or reformatted, that looks like the best option to keep travis happy to me. Someone more familiar with the codebase may well have a better suggestion though. |
Yep, sounds like a place to use rustfmt's skip attribute! |
I'm on holidays, so feel free to do it @elliotekj :p |
I created a PR, yet there are still things to discuss. @carols10cents, should we use the default At the moment, I sticked to the the default ones, but maybe you have something else in mind. |
I know I've been adding code to crates.io that isn't necessarily idiomatic rust formatting and I'd like to stop thinking about it and just run rustfmt :) There's probably a lot of code that isn't formatted the way rustfmt would do it though!!
This bug involves:
cargo fmt
in your crates.io checkoutThe text was updated successfully, but these errors were encountered: