Open
Description
Formatting incorrectly
I have this code
pub struct Test {
one: i32,
two: i32,
three_three: i32,
four: i32,
}
impl Test {
pub fn new(one: i32, bbb: i32, ccccc: i32, ddddd: i32) -> Self {
Self {
one: one,
two: bbb,
three_three: ccccc,
four: ddddd,
}
}
}
Executing formatting
pub struct Test {
one: i32,
two: i32,
three_three: i32,
four: i32,
}
impl Test {
pub fn new(one: i32, bbb: i32, ccccc: i32, ddddd: i32) -> Self {
Self {
one,
two: bbb,
three_three: ccccc,
four: ddddd,
}
}
}
Formatting again
pub struct Test {
one: i32,
two: i32,
three_three: i32,
four: i32,
}
impl Test {
pub fn new(one: i32, bbb: i32, ccccc: i32, ddddd: i32) -> Self {
Self {
one,
two: bbb,
three_three: ccccc,
four: ddddd,
}
}
}
When use_field_init_shorthand
is in effect,
the struct_field_align_threshold
behaves incorrectly.
Version
rustfmt 1.7.0-nightly (0ecbd06 2024-02-25)
Rustfmt Config
struct_field_align_threshold = 30
use_field_init_shorthand = true