Skip to content

Commit b6f283e

Browse files
committed
Ask rustfmt to make our imports consistent
These are nightly-only options: so keep them in a separate file. When it sees unstable features, stable rustfmt gives a diagnostic like: > Warning: can't set `imports_granularity = Module`, unstable features are only available in nightly channel. > Warning: can't set `group_imports = StdExternalCrate`, unstable features are only available in nightly channel. But: _does_ otherwise format the files and exit non-zero. However, this is noisy. We arrange that `cargo +nightly fmt-unstable` also does the right thing.
1 parent bce2e5e commit b6f283e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[alias]
2+
3+
fmt-unstable = ["fmt", "--", "--config-path", ".rustfmt.unstable.toml"]

.rustfmt.unstable.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# keep in sync with .rustfmt.toml
2+
chain_width = 40
3+
4+
# format imports
5+
group_imports = "StdExternalCrate"
6+
imports_granularity = "Module"

0 commit comments

Comments
 (0)