On Tue, Jun 30, 2026 at 10:35:00AM +0200, Miguel Ojeda wrote:
> On Mon, Jun 29, 2026 at 2:43 PM Zhongqiu Han
> <[email protected]> wrote:
> >
> > If the preferred style is to place each imported item on its own line,
> > shouldn't imports such as
> >
> > cpu, cpufreq,
> >
> > be formatted similarly as well?
>
> Indeed, good eyes.
>
> To do what we want, `rustfmt` needs the `//` at the end of that level
> too (in the future, it will be without the `//`), i.e. the patch
> probably passes `rustfmtcheck`, but it still needs to split that line
> and add the other `//`.
Hi Zhongqiu, Miguel:
Yes, I did run `make LLVM=1 rustfmtcheck` and it passed on this series. I will
fix
the missed ones in v2.
While investigating this, I found that that adding this config `imports_layout =
"Vertical"` to the rustfmt options would fix all the imports automatically,
including
the ones I missed. I ran it locally on the files touched in this series using
rustfmt
nightly and it correctly fixed the imports as desired:
rustup run nightly rustfmt --unstable-features \
--config "imports_layout=Vertical" \
--config-path .rustfmt.toml <file>
But unfortunately, since `imports_layout` is an unstable option currently [1],
it
cannot be used straightaway.
However, .rustfmt.toml already has a section of commented-out unstable options
kept
as a reference for when they stabilize. Would it make sense to add
`#imports_layout =
"Vertical"` there? If so, I can include it in v2.
[1]: https://github.com/rust-lang/rustfmt/issues/3361