merge_imports should be a little more conservative #2982
Labels
a-imports
`use` syntax
only-with-option
requires a non-default option value to reproduce
poor-formatting
I turned on
merge_imports
and rancargo fmt
over a codebase of mine, with mixed results. Since that option is not yet stable, I thought you might be interested in some feedback.Summary
Here is one change it made that I found useful:
From two lines down to one. Looking good 👍
Here is a change I found unnecessary:
This one went from 2 lines to 4, and became a bit of a maze to read.
Possible changes
The options for
merge_imports
aretrue
andfalse
. The import porridge is always either too hot or too cold. It would be nice if there were a "just right" option. I can think of a couple possibilities for the specific implementation:Only merge imported names that do not refer to a module:
Only merge at most a single level of names:
Whichever one is easier to implement or has fewest corner cases is probably the way to go.
In general, with the default options rustfmt has been very valuable to me and saved me a lot of time doing menial formatting. Thanks for working on it! 😄
The text was updated successfully, but these errors were encountered: