From 20bd1d4332605a85f2584ee0caf3563a56a9c5e2 Mon Sep 17 00:00:00 2001 From: Caleb Cartwright Date: Thu, 26 May 2022 21:56:35 -0500 Subject: [PATCH] docs: clarify imports_granularity behavior with comments --- CHANGELOG.md | 1 + Configurations.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e729bfb8486..3664571fe64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixed +- 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) - 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) - Fixed various `error[internal]: left behind trailing whitespace"` issues: - 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) diff --git a/Configurations.md b/Configurations.md index b3463fad19b..669da79087c 100644 --- a/Configurations.md +++ b/Configurations.md @@ -1705,6 +1705,8 @@ How imports should be grouped into `use` statements. Imports will be merged or s - **Possible values**: `Preserve`, `Crate`, `Module`, `Item`, `One` - **Stable**: No (tracking issue: [#4991](https://github.com/rust-lang/rustfmt/issues/4991)) +Note that rustfmt will not modify the granularity of imports containing comments if doing so could potentially lose or misplace said comments. + #### `Preserve` (default): Do not change the granularity of any imports and preserve the original structure written by the developer.