File tree 11 files changed +121
-2
lines changed
source/configs/group_imports
target/configs/group_imports
11 files changed +121
-2
lines changed Original file line number Diff line number Diff line change @@ -2062,7 +2062,7 @@ use sit;
2062
2062
Controls the strategy for how imports are grouped together.
2063
2063
2064
2064
- ** Default value** : ` Preserve `
2065
- - ** Possible values** : ` Preserve ` , ` StdExternalCrate `
2065
+ - ** Possible values** : ` Preserve ` , ` StdExternalCrate ` , ` One `
2066
2066
- ** Stable** : No
2067
2067
2068
2068
#### ` Preserve ` (default):
@@ -2108,6 +2108,23 @@ use super::update::convert_publish_payload;
2108
2108
use crate :: models :: Event ;
2109
2109
```
2110
2110
2111
+ #### ` One ` :
2112
+
2113
+ Discard existing import groups, and create a single group for everything
2114
+
2115
+ ``` rust
2116
+ use super :: schema :: {Context , Payload };
2117
+ use super :: update :: convert_publish_payload;
2118
+ use crate :: models :: Event ;
2119
+ use alloc :: alloc :: Layout ;
2120
+ use broker :: database :: PooledConnection ;
2121
+ use chrono :: Utc ;
2122
+ use core :: f32 ;
2123
+ use juniper :: {FieldError , FieldResult };
2124
+ use std :: sync :: Arc ;
2125
+ use uuid :: Uuid ;
2126
+ ```
2127
+
2111
2128
## ` reorder_modules `
2112
2129
2113
2130
Reorder ` mod ` declarations alphabetically in group.
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ pub enum GroupImportsTactic {
112
112
/// 2. other imports
113
113
/// 3. `self` / `crate` / `super` imports
114
114
StdExternalCrate ,
115
+ /// Discard existing groups, and create a single group for everything
116
+ One ,
115
117
}
116
118
117
119
#[ config_type]
Original file line number Diff line number Diff line change @@ -118,7 +118,9 @@ fn rewrite_reorderable_or_regroupable_items(
118
118
} ;
119
119
120
120
let mut regrouped_items = match context. config . group_imports ( ) {
121
- GroupImportsTactic :: Preserve => vec ! [ normalized_items] ,
121
+ GroupImportsTactic :: Preserve | GroupImportsTactic :: One => {
122
+ vec ! [ normalized_items]
123
+ }
122
124
GroupImportsTactic :: StdExternalCrate => group_imports ( normalized_items) ,
123
125
} ;
124
126
Original file line number Diff line number Diff line change
1
+ // rustfmt-group_imports: One
2
+ // rustfmt-imports_granularity: Crate
3
+ use chrono:: Utc ;
4
+ use super :: update:: convert_publish_payload;
5
+
6
+ use juniper:: { FieldError , FieldResult } ;
7
+ use uuid:: Uuid ;
8
+ use alloc:: alloc:: Layout ;
9
+
10
+ use std:: sync:: Arc ;
11
+ use alloc:: vec:: Vec ;
12
+
13
+ use broker:: database:: PooledConnection ;
14
+
15
+ use super :: schema:: { Context , Payload } ;
16
+ use core:: f32;
17
+ use crate :: models:: Event ;
Original file line number Diff line number Diff line change
1
+ // rustfmt-group_imports: One
2
+ mod test {
3
+ use crate :: foo:: bar;
4
+
5
+ use std:: path;
6
+ use crate :: foo:: bar2;
7
+ }
Original file line number Diff line number Diff line change
1
+ // rustfmt-group_imports: One
2
+ // rustfmt-reorder_imports: false
3
+ use chrono:: Utc ;
4
+ use super :: update:: convert_publish_payload;
5
+
6
+ use juniper:: { FieldError , FieldResult } ;
7
+ use uuid:: Uuid ;
8
+ use alloc:: alloc:: Layout ;
9
+
10
+ use std:: sync:: Arc ;
11
+
12
+ use broker:: database:: PooledConnection ;
13
+
14
+ use super :: schema:: { Context , Payload } ;
15
+ use core:: f32;
16
+ use crate :: models:: Event ;
Original file line number Diff line number Diff line change
1
+ // rustfmt-group_imports: One
2
+ use chrono:: Utc ;
3
+ use super :: update:: convert_publish_payload;
4
+
5
+ use juniper:: { FieldError , FieldResult } ;
6
+ use uuid:: Uuid ;
7
+ use alloc:: alloc:: Layout ;
8
+
9
+ use std:: sync:: Arc ;
10
+
11
+ use broker:: database:: PooledConnection ;
12
+
13
+ use super :: schema:: { Context , Payload } ;
14
+ use core:: f32;
15
+ use crate :: models:: Event ;
Original file line number Diff line number Diff line change
1
+ // rustfmt-group_imports: One
2
+ // rustfmt-imports_granularity: Crate
3
+ use super :: {
4
+ schema:: { Context , Payload } ,
5
+ update:: convert_publish_payload,
6
+ } ;
7
+ use crate :: models:: Event ;
8
+ use alloc:: { alloc:: Layout , vec:: Vec } ;
9
+ use broker:: database:: PooledConnection ;
10
+ use chrono:: Utc ;
11
+ use core:: f32;
12
+ use juniper:: { FieldError , FieldResult } ;
13
+ use std:: sync:: Arc ;
14
+ use uuid:: Uuid ;
Original file line number Diff line number Diff line change
1
+ // rustfmt-group_imports: One
2
+ mod test {
3
+ use crate :: foo:: bar;
4
+ use crate :: foo:: bar2;
5
+ use std:: path;
6
+ }
Original file line number Diff line number Diff line change
1
+ // rustfmt-group_imports: One
2
+ // rustfmt-reorder_imports: false
3
+ use chrono:: Utc ;
4
+ use super :: update:: convert_publish_payload;
5
+ use juniper:: { FieldError , FieldResult } ;
6
+ use uuid:: Uuid ;
7
+ use alloc:: alloc:: Layout ;
8
+ use std:: sync:: Arc ;
9
+ use broker:: database:: PooledConnection ;
10
+ use super :: schema:: { Context , Payload } ;
11
+ use core:: f32;
12
+ use crate :: models:: Event ;
Original file line number Diff line number Diff line change
1
+ // rustfmt-group_imports: One
2
+ use super :: schema:: { Context , Payload } ;
3
+ use super :: update:: convert_publish_payload;
4
+ use crate :: models:: Event ;
5
+ use alloc:: alloc:: Layout ;
6
+ use broker:: database:: PooledConnection ;
7
+ use chrono:: Utc ;
8
+ use core:: f32;
9
+ use juniper:: { FieldError , FieldResult } ;
10
+ use std:: sync:: Arc ;
11
+ use uuid:: Uuid ;
You can’t perform that action at this time.
0 commit comments