rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

[unstable option] force_multiline_blocks

Open scampi opened this issue 6 years ago • 2 comments

Tracking issue for unstable option: force_multiline_blocks

scampi avatar Feb 13 '19 22:02 scampi

Please, can this be stabilized? It's been 32 months.

(is there any way I can help?)

marcospb19 avatar Oct 07 '21 18:10 marcospb19

Right now it seems that when force_multiline_blocks is false (the default), it appears to operate logically as "force_singleline_blocks" = true.

I'll often have matches that look like:

match thing {
  Thing::Foo => small_func(),
  Thing::Bar => {
    a_function();
    b_function();
    c_function()
  }
}

But I'd like them to be formatted like so for consistency:

match thing {
  Thing::Foo => {
    one_func(),
  }
  Thing::Bar => {
    a_function();
    b_function();
    c_function()
  }
}

I could set force_multiline_blocks=true, but this will also force multiline even in places where I don't want it. It would be nice if there was something like "allow_multiline_blocks" that won't force it either way. That is, if the item was written multiline keep it as multiline; if it was written without multiline, keep it without multiline.

aloucks avatar Mar 07 '25 15:03 aloucks