Skip to content

Commit 19fa5c9

Browse files
committed
Update docs (and a function name)
1 parent 95cc135 commit 19fa5c9

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

src/chains.rs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,35 +54,26 @@
5454
/// .baz();
5555
/// ```
5656
///
57-
/// `chain_indent` dictates how the rest of the chain is aligned. This only seems
58-
/// to have an effect if the first non-root part of the chain is put on a
59-
/// newline, otherwise we align the dots:
60-
/// ```
61-
/// foo.bar
62-
/// .baz()
63-
/// ```
57+
/// `chain_indent` dictates how the rest of the chain is aligned.
6458
/// If the first item in the chain is a block expression, we align the dots with
6559
/// the braces.
66-
///
67-
/// Otherwise:
6860
/// Visual:
6961
/// ```
70-
/// let a = foo(aaa, bbb)
71-
/// .bar
72-
/// .baz()
62+
/// let a = foo.bar
63+
/// .baz()
64+
/// .qux
7365
/// ```
74-
/// Visual seems to be a tab indented from the indent of the whole expression.
7566
/// Inherit:
7667
/// ```
77-
/// let a = foo(aaa, bbb)
78-
/// .bar
68+
/// let a = foo.bar
7969
/// .baz()
70+
/// .qux
8071
/// ```
8172
/// Tabbed:
8273
/// ```
83-
/// let a = foo(aaa, bbb)
84-
/// .bar
74+
/// let a = foo.bar
8575
/// .baz()
76+
/// .qux
8677
/// ```
8778
/// `chains_overflow_last` applies only to chains where the last item is a
8879
/// method call. Usually, any line break in a chain sub-expression causes the
@@ -127,7 +118,7 @@ pub fn rewrite_chain(expr: &ast::Expr,
127118
} else if parent_rewrite.contains('\n') {
128119
(chain_indent(context, parent_block_indent.block_indent(context.config)), false)
129120
} else {
130-
(hacked_chain_indent(context, offset + Indent::new(0, parent_rewrite.len())), false)
121+
(chain_indent_newline(context, offset + Indent::new(0, parent_rewrite.len())), false)
131122
};
132123

133124
let max_width = try_opt!((width + offset.width()).checked_sub(indent.width()));
@@ -259,9 +250,9 @@ fn chain_indent(context: &RewriteContext, offset: Indent) -> Indent {
259250
}
260251
}
261252

262-
// Temporary hack - ignores visual indenting because this function should be
263-
// called where it is not possible to use visual indentation.
264-
fn hacked_chain_indent(context: &RewriteContext, _offset: Indent) -> Indent {
253+
// Ignores visual indenting because this function should be called where it is
254+
// not possible to use visual indentation because we are starting on a newline.
255+
fn chain_indent_newline(context: &RewriteContext, _offset: Indent) -> Indent {
265256
match context.config.chain_indent {
266257
BlockIndentStyle::Inherit => context.block_indent,
267258
BlockIndentStyle::Visual | BlockIndentStyle::Tabbed => {

0 commit comments

Comments
 (0)