rustfmt
rustfmt copied to clipboard
rustfmt does not respect brace_style when formatting imports
With:
hard_tabs = true
braces_style = "AlwaysNextLine"
control_brace_style = "AlwaysNextLine"
group_imports = "StdExternalCrate"
imports_granularity = "One"
imports_indent = "Block"
imports_layout = "Vertical"
indent_style = "Block"
newline_style = "Unix"
trailing_comma = "Vertical"
Current output:
use {
colored::{
ColoredString,
Colorize,
},
std::{
cmp::Ordering,
fmt::{
Display,
Formatter,
},
io::{
Read,
Write,
},
ops::{
ControlFlow,
RangeInclusive,
},
result::Result,
},
};
Expected output:
use
{
colored::
{
ColoredString,
Colorize,
},
std::
{
cmp::Ordering,
fmt::
{
Display,
Formatter,
},
io::
{
Read,
Write,
},
ops::
{
ControlFlow,
RangeInclusive,
},
result::Result,
},
};
Probably controversial, but having braces on the same line makes 0 sense with "AlwaysNextLine"
Is this a feature request?
I don't think the brace_style
config option was intended to be used with imports. The docs only give examples for functions, enums, and structs.