On Saturday 4 October 2025 03:53:34 CEST John Hubbard wrote:

> The main complaint with rustfmt is that it is extremely twitchy and
> unstable with respect to one-line, vs. multi-line output.
> 
> *Especially* with "use" statements.

The Black and Ruff formatting tools for Python use a "magic comma" rule 
that works well in practice: if the last item has a trailing comma, the 
items are guaranteed to be formatted multi-line, while if there is no 
trailing comma, single-line formatting is attempted.

I couldn't find documentation of the feature itself, but there is a 
settings flag to turn it off that contains an example:

https://docs.astral.sh/ruff/settings/#format_skip-magic-trailing-comma

Bye,
                Maarten



Reply via email to