#6829·rustfmt

Keep `use`d items on individual lines when requested

Author: tomassedovicCreated Mar 17, 2026Updated Sep 14, 2026

Feature Request

Summary

This is a request for an option to not collapse items in braced blocks into a single line. E.g.:

This (Example 1):

rust
use crate::{
    example1,
};

is now collapsed to:

rust
use crate::example1;

And this (Example 2):

rust
use crate::{
    example1,
    example2::{
        example3,
        example4,
        example5,
    },
    example6,
    example7,
    example8::example9,
};

is collapsed to:

rust
use crate::{
    example1,
    example2::{example3, example4, example5},
    example6, example7,
    example8::example9,
};

We would like for these items to remain within the braced blocks.

Motivation

This comes form the Linux kernel, where the coding style guidelines request each imported item be on a separate line:

https://docs.kernel.org/rust/coding-guidelines.html#imports

The justification is to minimise the diff when adding/removing new imports. This makes the changes easier to review as well as comment on.

That same reasoning can be extended to anyone who'd like to have the "line churn" reduced when making changes to the use sections.

Workaround

Right now, the Rust code in Linux works around this by appending a trailing double slash (//, an empty comment) to the last item before the ending brace, which leaves the spacing as is:

rust
use crate::{
    example1, //
};

and:

rust
use crate::{
    example1,
    example2::{
        example3,
        example4,
        example5, //
    },
    example6,
    example7,
    example8::example9, //
};

In other words, we'd like to have this behaviour without having to specify the empty comments.

Related configuration options

The Vertical imports_layout is almost what we want (it covers Example 2), but it collapses a single item within braces (Example 1). We'd like to be able to do both.