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):
use crate::{
example1,
};
is now collapsed to:
And this (Example 2):
use crate::{
example1,
example2::{
example3,
example4,
example5,
},
example6,
example7,
example8::example9,
};
is collapsed to:
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:
use crate::{
example1, //
};
and:
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.
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):
is now collapsed to:
And this (Example 2):
is collapsed to:
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
usesections.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:and:
In other words, we'd like to have this behaviour without having to specify the empty comments.
Related configuration options
The
Verticalimports_layoutis 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.