You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn_hincrbyex(_a:&muti64,_key:&i64,_field:&i64,_delta:i64,_iexpsec:i64,_b0:bool,) -> bool{false}fntest(){letmut conn:i64 = 0;let key:i64 = 0;let field:i64 = 0;let delta:i64 = 0;let iexpsec:i64 = 0;let is_xxxxxxxx:bool = false;let is_xxxxxxxxx:bool = false;let is_xxxxxxxxxxxxxxx:bool = false;let is_xxxxxxxxxxxxxxxx:bool = false;// single line: exactly 80 ------------------------------------------------|let _fut = _hincrbyex(&mut conn,&key,&field, delta, iexpsec, is_xxxxxxxx);// style 1: 81 ------------------------------------------------------------|let _fut =
_hincrbyex(&mut conn,&key,&field, delta, iexpsec, is_xxxxxxxxx);// style 1: exactly 80 for the second line --------------------------------|let _fut =
_hincrbyex(&mut conn,&key,&field, delta, iexpsec, is_xxxxxxxxxxxxxxx);// style 2: 81 for the second line in style 1 -----------------------------|let _fut = _hincrbyex(&mut conn,&key,&field,
delta,
iexpsec,
is_xxxxxxxxxxxxxxxx,);}
According to the above example, rustfmt have two line break styles for long statement. But I really don't like the style 1 because it looks strange in some cases. I have to make some tricky adjustments such as rename the function name / rename some argument names / ... to change the style 1 to single line or style 2. And it bothers me too in some other situations such as match-arms.
I wish to have some new options in rustfmt.toml to disable the style 1, a statement should directly be formatted to the style 2 from single line if it's too long. Thanks~
The text was updated successfully, but these errors were encountered:
I see. with #3514, I think these can be roughly summarized into the following situations:
for max_width = 80
line length situations:
len(line) <= 80
len(line) > 80, after breaking into two line, len(line2) <= 80
len(line) > 80, after breaking into two line, len(line2) > 80
line break style:
single line
vertical
single line for line2
vertical for line2
examples for line break style:
// 1. single linelet res = f_abc(a, b, c);// 2. verticallet res = f_abc(
a,
b,
c,);// 3. single line for line2let res =
f_abc(a, b, c);// 4. vertical for line2let res =
f_abc(
a,
b,
c,);
version
rustfmt 1.7.1-nightly (94885bc6 2024-09-01)
rustfmt.toml
example
According to the above example, rustfmt have two line break styles for long statement. But I really don't like the style 1 because it looks strange in some cases. I have to make some tricky adjustments such as rename the function name / rename some argument names / ... to change the style 1 to single line or style 2. And it bothers me too in some other situations such as match-arms.
I wish to have some new options in rustfmt.toml to disable the style 1, a statement should directly be formatted to the style 2 from single line if it's too long. Thanks~
The text was updated successfully, but these errors were encountered: