Is there a way to prevent formatting of else { trivial expression }

464 Views Asked by At

I often have code like

    if condition {
             // code that deserves to 
             // be formatted as block
    }
    else { None }   // or some other trivial expression

Now, is there a way to prevent rustfmt from wasting two lines formatting the trivial else part like this:

    else {
        None
    }

Note that single_line_if_else_maxwidth doesn't help, as the "then" part is too long.

0

There are 0 best solutions below