Merge pull request #2115 from topecongiro/chain_width
Rename 'chain_one_line_max' to 'chain_width'
This commit is contained in:
commit
15894e94ef
9 changed files with 15 additions and 15 deletions
|
@ -227,26 +227,26 @@ let lorem = ipsum.dolor()
|
|||
.elit();
|
||||
```
|
||||
|
||||
See also [`chain_one_line_max`](#chain_one_line_max).
|
||||
See also [`chain_width`](#chain_width).
|
||||
|
||||
## `chain_one_line_max`
|
||||
## `chain_width`
|
||||
|
||||
Maximum length of a chain to fit on a single line
|
||||
|
||||
- **Default value**: `60`
|
||||
- **Possible values**: any positive integer
|
||||
|
||||
#### Lines shorter than `chain_one_line_max`:
|
||||
#### Lines shorter than `chain_width`:
|
||||
```rust
|
||||
let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
|
||||
```
|
||||
|
||||
#### Lines longer than `chain_one_line_max`:
|
||||
#### Lines longer than `chain_width`:
|
||||
See [`chain_indent`](#chain_indent).
|
||||
|
||||
## `chain_split_single_child`
|
||||
|
||||
Split a chain with a single child if its length exceeds [`chain_one_line_max`](#chain_one_line_max).
|
||||
Split a chain with a single child if its length exceeds [`chain_width`](#chain_width).
|
||||
|
||||
- **Default value**: `false`
|
||||
- **Possible values**: `false`, `true`
|
||||
|
@ -264,7 +264,7 @@ let files = fs::read_dir("tests/coverage/source")
|
|||
.expect("Couldn't read source dir");
|
||||
```
|
||||
|
||||
See also [`chain_one_line_max`](#chain_one_line_max).
|
||||
See also [`chain_width`](#chain_width).
|
||||
|
||||
## `closure_block_indent_threshold`
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
|
|||
let one_line_budget = if rewrites.is_empty() && !context.config.chain_split_single_child() {
|
||||
shape.width
|
||||
} else {
|
||||
min(shape.width, context.config.chain_one_line_max())
|
||||
min(shape.width, context.config.chain_width())
|
||||
};
|
||||
let all_in_one_line = !parent_rewrite_contains_newline
|
||||
&& rewrites.iter().all(|s| !s.contains('\n'))
|
||||
|
|
|
@ -587,9 +587,9 @@ create_config! {
|
|||
report_fixme: ReportTactic, ReportTactic::Never, false,
|
||||
"Report all, none or unnumbered occurrences of FIXME in source file comments";
|
||||
chain_indent: IndentStyle, IndentStyle::Block, false, "Indentation of chain";
|
||||
chain_one_line_max: usize, 60, false, "Maximum length of a chain to fit on a single line";
|
||||
chain_width: usize, 60, false, "Maximum length of a chain to fit on a single line";
|
||||
chain_split_single_child: bool, false, false, "Split a chain with a single child if its length \
|
||||
exceeds `chain_one_line_max`";
|
||||
exceeds `chain_width`";
|
||||
imports_indent: IndentStyle, IndentStyle::Visual, false, "Indent of imports";
|
||||
imports_layout: ListTactic, ListTactic::Mixed, false, "Item layout inside a import block";
|
||||
reorder_extern_crates: bool, true, false, "Reorder extern crate statements alphabetically";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-single_line_if_else_max_width: 0
|
||||
// rustfmt-chain_one_line_max: 100
|
||||
// rustfmt-chain_width: 100
|
||||
// Test chain formatting.
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// rustfmt-chain_one_line_max: 10
|
||||
// rustfmt-chain_width: 10
|
||||
// Chain one line max
|
||||
|
||||
fn main() {
|
|
@ -1,4 +1,4 @@
|
|||
// rustfmt-chain_one_line_max: 100
|
||||
// rustfmt-chain_width: 100
|
||||
// Chain one line max
|
||||
|
||||
fn main() {
|
|
@ -1,6 +1,6 @@
|
|||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-single_line_if_else_max_width: 0
|
||||
// rustfmt-chain_one_line_max: 100
|
||||
// rustfmt-chain_width: 100
|
||||
// Test chain formatting.
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// rustfmt-chain_one_line_max: 10
|
||||
// rustfmt-chain_width: 10
|
||||
// Chain one line max
|
||||
|
||||
fn main() {
|
|
@ -1,4 +1,4 @@
|
|||
// rustfmt-chain_one_line_max: 100
|
||||
// rustfmt-chain_width: 100
|
||||
// Chain one line max
|
||||
|
||||
fn main() {
|
Loading…
Add table
Add a link
Reference in a new issue