mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
group_imports: test and document non-consecutive imports
This commit is contained in:
parent
2d9bc46010
commit
4f3f87fb9a
@ -2061,12 +2061,16 @@ use sit;
|
||||
|
||||
## `group_imports`
|
||||
|
||||
Controls the strategy for how imports are grouped together.
|
||||
Controls the strategy for how consecutive imports are grouped together.
|
||||
|
||||
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.
|
||||
|
||||
- **Default value**: `Preserve`
|
||||
- **Possible values**: `Preserve`, `StdExternalCrate`, `One`
|
||||
- **Stable**: No (tracking issue: [#5083](https://github.com/rust-lang/rustfmt/issues/5083))
|
||||
|
||||
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.
|
||||
|
||||
#### `Preserve` (default):
|
||||
|
||||
Preserve the source file's import groups.
|
||||
|
@ -0,0 +1,27 @@
|
||||
// rustfmt-group_imports: StdExternalCrate
|
||||
use chrono::Utc;
|
||||
use super::update::convert_publish_payload;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
use juniper::{FieldError, FieldResult};
|
||||
|
||||
use uuid::Uuid;
|
||||
use alloc::alloc::Layout;
|
||||
|
||||
extern crate uuid;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
use broker::database::PooledConnection;
|
||||
|
||||
use super::schema::{Context, Payload};
|
||||
use core::f32;
|
||||
use crate::models::Event;
|
@ -0,0 +1,18 @@
|
||||
// rustfmt-group_imports: StdExternalCrate
|
||||
use alloc::alloc::Layout;
|
||||
|
||||
use chrono::Utc;
|
||||
use juniper::{FieldError, FieldResult};
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::update::convert_publish_payload;
|
||||
|
||||
extern crate uuid;
|
||||
|
||||
use core::f32;
|
||||
use std::sync::Arc;
|
||||
|
||||
use broker::database::PooledConnection;
|
||||
|
||||
use super::schema::{Context, Payload};
|
||||
use crate::models::Event;
|
Loading…
Reference in New Issue
Block a user