Skip to content

Commit 9a09e5b

Browse files
committed
Catchup with all master changes
2 parents a13b236 + 19b34fe commit 9a09e5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1678
-337
lines changed

.github/workflows/windows.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
1515
# In order to prevent overusing too much of that 60 limit, we throttle the
1616
# number of rustfmt jobs that will run concurrently.
17-
max-parallel: 1
17+
max-parallel: 2
1818
fail-fast: false
1919
matrix:
2020
target: [
@@ -50,6 +50,17 @@ jobs:
5050
profile: minimal
5151
default: true
5252

53+
- name: Add mingw32 to path for i686-gnu
54+
run: |
55+
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
56+
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
57+
shell: bash
58+
59+
- name: Add mingw64 to path for x86_64-gnu
60+
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
61+
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
62+
shell: bash
63+
5364
- name: cargo-make
5465
run: cargo install --force cargo-make
5566

Cargo.lock

Lines changed: 40 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,32 +107,32 @@ lazy_static = "1.0.0"
107107

108108
[dependencies.rustc_ast]
109109
package = "rustc-ap-rustc_ast"
110-
version = "691.0.0"
110+
version = "697.0.0"
111111

112112
[dependencies.rustc_ast_pretty]
113113
package = "rustc-ap-rustc_ast_pretty"
114-
version = "691.0.0"
114+
version = "697.0.0"
115115

116116
[dependencies.rustc_data_structures]
117117
package = "rustc-ap-rustc_data_structures"
118-
version = "691.0.0"
118+
version = "697.0.0"
119119

120120
[dependencies.rustc_errors]
121121
package = "rustc-ap-rustc_errors"
122-
version = "691.0.0"
122+
version = "697.0.0"
123123

124124
[dependencies.rustc_expand]
125125
package = "rustc-ap-rustc_expand"
126-
version = "691.0.0"
126+
version = "697.0.0"
127127

128128
[dependencies.rustc_parse]
129129
package = "rustc-ap-rustc_parse"
130-
version = "691.0.0"
130+
version = "697.0.0"
131131

132132
[dependencies.rustc_session]
133133
package = "rustc-ap-rustc_session"
134-
version = "691.0.0"
134+
version = "697.0.0"
135135

136136
[dependencies.rustc_span]
137137
package = "rustc-ap-rustc_span"
138-
version = "691.0.0"
138+
version = "697.0.0"

Configurations.md

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ fn main() {
569569
Specifies which edition is used by the parser.
570570

571571
- **Default value**: `"2015"`
572-
- **Possible values**: `"2015"`, `"2018"`
572+
- **Possible values**: `"2015"`, `"2018"`, `"2021"`
573573
- **Stable**: Yes
574574

575575
Rustfmt is able to pick up the edition used by reading the `Cargo.toml` file if executed
@@ -1705,13 +1705,71 @@ pub enum Foo {}
17051705
pub enum Foo {}
17061706
```
17071707

1708-
## `merge_imports`
1708+
## `imports_granularity`
1709+
1710+
Merge together related imports based on their paths.
1711+
1712+
- **Default value**: `Preserve`
1713+
- **Possible values**: `Preserve`, `Crate`, `Module`, `Item`
1714+
- **Stable**: No
1715+
1716+
#### `Preserve` (default):
17091717

1710-
Merge multiple imports into a single nested import.
1718+
Do not perform any merging and preserve the original structure written by the developer.
17111719

1720+
```rust
1721+
use foo::b;
1722+
use foo::b::{f, g};
1723+
use foo::{a, c, d::e};
1724+
use qux::{h, i};
1725+
```
1726+
1727+
#### `Crate`:
1728+
1729+
Merge imports from the same crate into a single `use` statement. Conversely, imports from different crates are split into separate statements.
1730+
1731+
```rust
1732+
use foo::{
1733+
a, b,
1734+
b::{f, g},
1735+
c,
1736+
d::e,
1737+
};
1738+
use qux::{h, i};
1739+
```
1740+
1741+
#### `Module`:
1742+
1743+
Merge imports from the same module into a single `use` statement. Conversely, imports from different modules are split into separate statements.
1744+
1745+
```rust
1746+
use foo::b::{f, g};
1747+
use foo::d::e;
1748+
use foo::{a, b, c};
1749+
use qux::{h, i};
1750+
```
1751+
1752+
#### `Item`:
1753+
1754+
Flatten imports so that each has its own `use` statement.
1755+
1756+
```rust
1757+
use foo::a;
1758+
use foo::b;
1759+
use foo::b::f;
1760+
use foo::b::g;
1761+
use foo::c;
1762+
use foo::d::e;
1763+
use qux::h;
1764+
use qux::i;
1765+
```
1766+
1767+
## `merge_imports`
1768+
1769+
This option is deprecated. Use `imports_granularity = "Crate"` instead.
1770+
17121771
- **Default value**: `false`
17131772
- **Possible values**: `true`, `false`
1714-
- **Stable**: No (tracking issue: [#3362](https://github.com/rust-lang/rustfmt/issues/3362))
17151773

17161774
#### `false` (default):
17171775

@@ -1727,7 +1785,6 @@ use foo::{e, f};
17271785
use foo::{a, b, c, d, e, f, g};
17281786
```
17291787

1730-
17311788
## `newline_style`
17321789

17331790
Unix or Windows line endings
@@ -2560,7 +2617,7 @@ Enable unstable features on stable and beta channels (unstable features are avai
25602617

25612618
For example:
25622619
```bash
2563-
rustfmt src/lib.rs --config unstable_features=true merge_imports=true
2620+
rustfmt src/lib.rs --config unstable_features=true imports_granularity=Crate
25642621
```
25652622

25662623
## `use_field_init_shorthand`

0 commit comments

Comments
 (0)