Skip to content

Commit fca0074

Browse files
authored
Merge pull request #2313 from LukasKalbertodt/patch-1
Add options `blank_lines_{lower|upper}_bound` to `Configurations.md`
2 parents 9368de2 + 5de87bd commit fca0074

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

Configurations.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,3 +1815,97 @@ What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff,
18151815
- **Default value**: `"Overwrite"`
18161816
- **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`
18171817
- **Stable**: No
1818+
1819+
## `blank_lines_upper_bound`
1820+
1821+
Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
1822+
lines are found, they are trimmed down to match this integer.
1823+
1824+
- **Default value**: `1`
1825+
- **Possible values**: *unsigned integer*
1826+
- **Stable**: No
1827+
1828+
### Example
1829+
Original Code:
1830+
1831+
```rust
1832+
fn foo() {
1833+
println!("a");
1834+
}
1835+
1836+
1837+
1838+
fn bar() {
1839+
println!("b");
1840+
1841+
1842+
println!("c");
1843+
}
1844+
```
1845+
1846+
#### `1` (default):
1847+
```rust
1848+
fn foo() {
1849+
println!("a");
1850+
}
1851+
1852+
fn bar() {
1853+
println!("b");
1854+
1855+
println!("c");
1856+
}
1857+
```
1858+
1859+
#### `2` (default):
1860+
```rust
1861+
fn foo() {
1862+
println!("a");
1863+
}
1864+
1865+
1866+
fn bar() {
1867+
println!("b");
1868+
1869+
1870+
println!("c");
1871+
}
1872+
```
1873+
1874+
See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
1875+
1876+
## `blank_lines_lower_bound`
1877+
1878+
Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
1879+
them, additional blank lines are inserted.
1880+
1881+
- **Default value**: `0`
1882+
- **Possible values**: *unsigned integer*
1883+
- **Stable**: No
1884+
1885+
### Example
1886+
Original Code (rustfmt will not change it with the default value of `0`):
1887+
1888+
```rust
1889+
fn foo() {
1890+
println!("a");
1891+
}
1892+
fn bar() {
1893+
println!("b");
1894+
println!("c");
1895+
}
1896+
```
1897+
1898+
#### `1`
1899+
```rust
1900+
fn foo() {
1901+
1902+
println!("a");
1903+
}
1904+
1905+
fn bar() {
1906+
1907+
println!("b");
1908+
1909+
println!("c");
1910+
}
1911+
```

0 commit comments

Comments
 (0)