Skip to content

Commit 4f3f87f

Browse files
tommilligancalebcartwright
authored andcommitted
group_imports: test and document non-consecutive imports
1 parent 2d9bc46 commit 4f3f87f

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

Diff for: Configurations.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2061,12 +2061,16 @@ use sit;
20612061

20622062
## `group_imports`
20632063

2064-
Controls the strategy for how imports are grouped together.
2064+
Controls the strategy for how consecutive imports are grouped together.
2065+
2066+
Controls the strategy for grouping sets of consecutive imports. Imports may contain newlines between imports and still be grouped together as a single set, but other statements between imports will result in different grouping sets.
20652067

20662068
- **Default value**: `Preserve`
20672069
- **Possible values**: `Preserve`, `StdExternalCrate`, `One`
20682070
- **Stable**: No (tracking issue: [#5083](https://github.com/rust-lang/rustfmt/issues/5083))
20692071

2072+
Each set of imports (one or more `use` statements, optionally separated by newlines) will be formatted independently. Other statements such as `mod ...` or `extern crate ...` will cause imports to not be grouped together.
2073+
20702074
#### `Preserve` (default):
20712075

20722076
Preserve the source file's import groups.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// rustfmt-group_imports: StdExternalCrate
2+
use chrono::Utc;
3+
use super::update::convert_publish_payload;
4+
5+
6+
7+
8+
9+
use juniper::{FieldError, FieldResult};
10+
11+
use uuid::Uuid;
12+
use alloc::alloc::Layout;
13+
14+
extern crate uuid;
15+
16+
17+
18+
19+
20+
use std::sync::Arc;
21+
22+
23+
use broker::database::PooledConnection;
24+
25+
use super::schema::{Context, Payload};
26+
use core::f32;
27+
use crate::models::Event;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// rustfmt-group_imports: StdExternalCrate
2+
use alloc::alloc::Layout;
3+
4+
use chrono::Utc;
5+
use juniper::{FieldError, FieldResult};
6+
use uuid::Uuid;
7+
8+
use super::update::convert_publish_payload;
9+
10+
extern crate uuid;
11+
12+
use core::f32;
13+
use std::sync::Arc;
14+
15+
use broker::database::PooledConnection;
16+
17+
use super::schema::{Context, Payload};
18+
use crate::models::Event;

0 commit comments

Comments
 (0)