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:
parent
e58e7b10e1
commit
cb93e9c0ec
2 changed files with 22 additions and 19 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue