Compute indent never relative to current column
Previously the pretty printer would compute indentation always relative
to whatever column a block begins at, like this:
fn demo(arg1: usize,
arg2: usize);
This is never the thing to do in the dominant contemporary Rust style.
Rustfmt's default and the style used by the vast majority of Rust
codebases is block indentation:
fn demo(
arg1: usize,
arg2: usize,
);
where every indentation level is a multiple of 4 spaces and each level
is indented relative to the indentation of the previous line, not the
position that the block starts in.
This commit is contained in:
@@ -655,7 +655,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
|
||||
// Outer-box is consistent.
|
||||
self.cbox(INDENT_UNIT);
|
||||
// Head-box is inconsistent.
|
||||
self.ibox(w.len() + 1);
|
||||
self.ibox(0);
|
||||
// Keyword that starts the head.
|
||||
if !w.is_empty() {
|
||||
self.word_nbsp(w);
|
||||
|
||||
Reference in New Issue
Block a user