Skip to content

Commit 15894e9

Browse files
authored
Merge pull request #2115 from topecongiro/chain_width
Rename 'chain_one_line_max' to 'chain_width'
2 parents 0b481ce + 619bc91 commit 15894e9

9 files changed

+15
-15
lines changed

Configurations.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -227,26 +227,26 @@ let lorem = ipsum.dolor()
227227
.elit();
228228
```
229229

230-
See also [`chain_one_line_max`](#chain_one_line_max).
230+
See also [`chain_width`](#chain_width).
231231

232-
## `chain_one_line_max`
232+
## `chain_width`
233233

234234
Maximum length of a chain to fit on a single line
235235

236236
- **Default value**: `60`
237237
- **Possible values**: any positive integer
238238

239-
#### Lines shorter than `chain_one_line_max`:
239+
#### Lines shorter than `chain_width`:
240240
```rust
241241
let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
242242
```
243243

244-
#### Lines longer than `chain_one_line_max`:
244+
#### Lines longer than `chain_width`:
245245
See [`chain_indent`](#chain_indent).
246246

247247
## `chain_split_single_child`
248248

249-
Split a chain with a single child if its length exceeds [`chain_one_line_max`](#chain_one_line_max).
249+
Split a chain with a single child if its length exceeds [`chain_width`](#chain_width).
250250

251251
- **Default value**: `false`
252252
- **Possible values**: `false`, `true`
@@ -264,7 +264,7 @@ let files = fs::read_dir("tests/coverage/source")
264264
.expect("Couldn't read source dir");
265265
```
266266

267-
See also [`chain_one_line_max`](#chain_one_line_max).
267+
See also [`chain_width`](#chain_width).
268268

269269
## `closure_block_indent_threshold`
270270

src/chains.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
161161
let one_line_budget = if rewrites.is_empty() && !context.config.chain_split_single_child() {
162162
shape.width
163163
} else {
164-
min(shape.width, context.config.chain_one_line_max())
164+
min(shape.width, context.config.chain_width())
165165
};
166166
let all_in_one_line = !parent_rewrite_contains_newline
167167
&& rewrites.iter().all(|s| !s.contains('\n'))

src/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,9 @@ create_config! {
587587
report_fixme: ReportTactic, ReportTactic::Never, false,
588588
"Report all, none or unnumbered occurrences of FIXME in source file comments";
589589
chain_indent: IndentStyle, IndentStyle::Block, false, "Indentation of chain";
590-
chain_one_line_max: usize, 60, false, "Maximum length of a chain to fit on a single line";
590+
chain_width: usize, 60, false, "Maximum length of a chain to fit on a single line";
591591
chain_split_single_child: bool, false, false, "Split a chain with a single child if its length \
592-
exceeds `chain_one_line_max`";
592+
exceeds `chain_width`";
593593
imports_indent: IndentStyle, IndentStyle::Visual, false, "Indent of imports";
594594
imports_layout: ListTactic, ListTactic::Mixed, false, "Item layout inside a import block";
595595
reorder_extern_crates: bool, true, false, "Reorder extern crate statements alphabetically";

tests/source/chains.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-normalize_comments: true
22
// rustfmt-single_line_if_else_max_width: 0
3-
// rustfmt-chain_one_line_max: 100
3+
// rustfmt-chain_width: 100
44
// Test chain formatting.
55

66
fn main() {

tests/source/configs-chain_one_line_max-above.rs renamed to tests/source/configs-chain_width-above.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-chain_one_line_max: 10
1+
// rustfmt-chain_width: 10
22
// Chain one line max
33

44
fn main() {

tests/source/configs-chain_one_line_max-below.rs renamed to tests/source/configs-chain_width-below.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-chain_one_line_max: 100
1+
// rustfmt-chain_width: 100
22
// Chain one line max
33

44
fn main() {

tests/target/chains.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-normalize_comments: true
22
// rustfmt-single_line_if_else_max_width: 0
3-
// rustfmt-chain_one_line_max: 100
3+
// rustfmt-chain_width: 100
44
// Test chain formatting.
55

66
fn main() {

tests/target/configs-chain_one_line_max-above.rs renamed to tests/target/configs-chain_width-above.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-chain_one_line_max: 10
1+
// rustfmt-chain_width: 10
22
// Chain one line max
33

44
fn main() {

tests/target/configs-chain_one_line_max-below.rs renamed to tests/target/configs-chain_width-below.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-chain_one_line_max: 100
1+
// rustfmt-chain_width: 100
22
// Chain one line max
33

44
fn main() {

0 commit comments

Comments
 (0)