-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ExternalCrate
import grouping style
#5723
Open
shepmaster
wants to merge
2
commits into
rust-lang:master
Choose a base branch
from
shepmaster:external-crate-grouping
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/source/configs/group_imports/ExternalCrate-merge_imports.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
// rustfmt-imports_granularity: Crate | ||
use chrono::Utc; | ||
use super::update::convert_publish_payload; | ||
|
||
use juniper::{FieldError, FieldResult}; | ||
use uuid::Uuid; | ||
use alloc::alloc::Layout; | ||
|
||
use std::sync::Arc; | ||
use alloc::vec::Vec; | ||
|
||
use broker::database::PooledConnection; | ||
|
||
use super::schema::{Context, Payload}; | ||
use core::f32; | ||
use crate::models::Event; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
mod test { | ||
use crate::foo::bar; | ||
use std::path; | ||
use crate::foo::bar2; | ||
use uuid::Uuid; | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/source/configs/group_imports/ExternalCrate-no_reorder.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
// rustfmt-reorder_imports: false | ||
|
||
use chrono::Utc; | ||
use super::update::convert_publish_payload; | ||
|
||
use juniper::{FieldError, FieldResult}; | ||
use uuid::Uuid; | ||
use alloc::alloc::Layout; | ||
|
||
use std::sync::Arc; | ||
|
||
use broker::database::PooledConnection; | ||
|
||
use super::schema::{Context, Payload}; | ||
use core::f32; | ||
use crate::models::Event; |
27 changes: 27 additions & 0 deletions
27
tests/source/configs/group_imports/ExternalCrate-non_consecutive.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
use chrono::Utc; | ||
use super::update::convert_publish_payload; | ||
|
||
use juniper::{FieldError, FieldResult}; | ||
use uuid::Uuid; | ||
use alloc::alloc::Layout; | ||
|
||
use std::sync::Arc; | ||
|
||
use broker::database::PooledConnection; | ||
|
||
use super::schema::{Context, Payload}; | ||
use core::f32; | ||
use crate::models::Event; |
15 changes: 15 additions & 0 deletions
15
tests/target/configs/group_imports/ExternalCrate-merge_imports.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
// rustfmt-imports_granularity: Crate | ||
use alloc::{alloc::Layout, vec::Vec}; | ||
use broker::database::PooledConnection; | ||
use chrono::Utc; | ||
use core::f32; | ||
use juniper::{FieldError, FieldResult}; | ||
use std::sync::Arc; | ||
use uuid::Uuid; | ||
|
||
use super::{ | ||
schema::{Context, Payload}, | ||
update::convert_publish_payload, | ||
}; | ||
use crate::models::Event; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
mod test { | ||
use std::path; | ||
use uuid::Uuid; | ||
|
||
use crate::foo::bar; | ||
use crate::foo::bar2; | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/target/configs/group_imports/ExternalCrate-no_reorder.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
// rustfmt-reorder_imports: false | ||
|
||
use chrono::Utc; | ||
use juniper::{FieldError, FieldResult}; | ||
use uuid::Uuid; | ||
use alloc::alloc::Layout; | ||
use std::sync::Arc; | ||
use broker::database::PooledConnection; | ||
use core::f32; | ||
|
||
use super::update::convert_publish_payload; | ||
use super::schema::{Context, Payload}; | ||
use crate::models::Event; |
16 changes: 16 additions & 0 deletions
16
tests/target/configs/group_imports/ExternalCrate-non_consecutive.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
use alloc::alloc::Layout; | ||
use chrono::Utc; | ||
use juniper::{FieldError, FieldResult}; | ||
use uuid::Uuid; | ||
|
||
use super::update::convert_publish_payload; | ||
|
||
extern crate uuid; | ||
|
||
use broker::database::PooledConnection; | ||
use core::f32; | ||
use std::sync::Arc; | ||
|
||
use super::schema::{Context, Payload}; | ||
use crate::models::Event; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// rustfmt-group_imports: ExternalCrate | ||
use alloc::alloc::Layout; | ||
use broker::database::PooledConnection; | ||
use chrono::Utc; | ||
use core::f32; | ||
use juniper::{FieldError, FieldResult}; | ||
use std::sync::Arc; | ||
use uuid::Uuid; | ||
|
||
use super::schema::{Context, Payload}; | ||
use super::update::convert_publish_payload; | ||
use crate::models::Event; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be a way to deduplicate this and
StdExternalCrate
, by either callinggroup_imports_std_external_crate
in this function or calling this function in the other function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a while since I was in the code, but I have a vague recollection that there wasn't much that was useful to DRY up here. That being said, WDYT about something that results in:
and