Skip to content

Commit 3e38399

Browse files
docs: clarify imports_granularity behavior with comments
1 parent 73be264 commit 3e38399

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Fixed
1010

11+
- Don't change granularity of imports containing comments with `imports_granularity` if doing so could lose or misplace those comments [#5311](https://github.com/rust-lang/rustfmt/pull/5311)
1112
- Prevent rustfmt from removing trailing comments at the end of files annotated with inner `#![rustfmt::skip]` attributes [#5033](https://github.com/rust-lang/rustfmt/issues/5033)
1213
- Fixed various `error[internal]: left behind trailing whitespace"` issues:
1314
- Remove trailing whitespace when formatting a where clause who's bounds have an empty right hand side [#5012](https://github.com/rust-lang/rustfmt/issues/5012) [#4850](https://github.com/rust-lang/rustfmt/issues/4850)

Configurations.md

+2
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,8 @@ How imports should be grouped into `use` statements. Imports will be merged or s
17051705
- **Possible values**: `Preserve`, `Crate`, `Module`, `Item`, `One`
17061706
- **Stable**: No (tracking issue: [#4991](https://github.com/rust-lang/rustfmt/issues/4991))
17071707

1708+
Note that rustfmt will not modify the granularity of imports containing comments if doing so could potentially lose or misplace said comments.
1709+
17081710
#### `Preserve` (default):
17091711

17101712
Do not change the granularity of any imports and preserve the original structure written by the developer.

0 commit comments

Comments
 (0)