-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Cargo fmt #1550
Cargo fmt #1550
Conversation
I think we should try to tweak rustfmt's style a bit, for example, this change: let steps: i64 = if CONFIG.authenticator_disable_time_drift() { 0 } else { 1 };
let steps: i64 = if CONFIG.authenticator_disable_time_drift() {
0
} else {
1
}; Looks worse afterwards. Then sometimes it decides to not split lines at all, like this:
Which I assume is because of the macro, but i'd rather that change not be done. There are others too, particularly with long strings as function parameters, where it moves the string to a new line and it barely reduces the width, in those cases it might be better to split the string and escape the newline with \ I don't know if those things are configurable in rustfmt, if they aren't I'll just have to deal with it 😄 |
@dani-garcia I've re-applied to updated |
I did some testing, and i think i have a nice config. The only thing missing is a new feature so that chains are not being put on one line as we now have a lot of those separated on a new-line, and using fmt now will compress those to one line. In v2.x they have this, and i see that there is a PR open for a backport of this feature: rust-lang/rustfmt#4782 , which i would really like to see merged, and then we could use that to have it more inline with how our code looks right now. These is btw my tested settings version = "Two"
edition = "2018"
max_width = 225
newline_style = "Unix"
use_small_heuristics = "Off"
struct_lit_single_line = false
overflow_delimited_expr = true |
I'll try running with that config, see what the diff looks like. |
I checked with |
Turns out there's already a |
Run
cargo fmt
on the codebase, and add it to CI