-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
One
option for imports_granularity (#4669)
This option merges all imports into a single `use` statement as long as they have the same visibility.
- Loading branch information
1 parent
a9876e8
commit 967cff2
Showing
6 changed files
with
289 additions
and
19 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// rustfmt-imports_granularity: One | ||
|
||
use b; | ||
use a::ac::{aca, acb}; | ||
use a::{aa::*, ab}; | ||
|
||
use a as x; | ||
use b::ba; | ||
use a::{aa, ab}; | ||
|
||
use a::aa::aaa; | ||
use a::ab::aba as x; | ||
use a::aa::*; | ||
|
||
use a::aa; | ||
use a::ad::ada; | ||
#[cfg(test)] | ||
use a::{ab, ac::aca}; | ||
use b; | ||
#[cfg(test)] | ||
use b::{ | ||
ba, bb, | ||
bc::bca::{bcaa, bcab}, | ||
}; | ||
|
||
pub use a::aa; | ||
pub use a::ae; | ||
use a::{ab, ac, ad}; | ||
use b::ba; | ||
pub use b::{bb, bc::bca}; | ||
|
||
use a::aa::aaa; | ||
use a::ac::{aca, acb}; | ||
use a::{aa::*, ab}; | ||
use b::{ | ||
ba, | ||
bb::{self, bba}, | ||
}; | ||
|
||
use crate::a; | ||
use crate::b::ba; | ||
use c::ca; | ||
|
||
use super::a; | ||
use c::ca; | ||
use super::b::ba; | ||
|
||
use crate::a; | ||
use super::b; | ||
use c::{self, ca}; | ||
|
||
use a::{ | ||
// some comment | ||
aa::{aaa, aab}, | ||
ab, | ||
// another comment | ||
ac::aca, | ||
}; | ||
use b as x; | ||
use a::ad::ada; |
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,79 @@ | ||
// rustfmt-imports_granularity: One | ||
|
||
use { | ||
a::{ | ||
aa::*, | ||
ab, | ||
ac::{aca, acb}, | ||
}, | ||
b, | ||
}; | ||
|
||
use { | ||
a::{self as x, aa, ab}, | ||
b::ba, | ||
}; | ||
|
||
use a::{ | ||
aa::{aaa, *}, | ||
ab::aba as x, | ||
}; | ||
|
||
#[cfg(test)] | ||
use a::{ab, ac::aca}; | ||
#[cfg(test)] | ||
use b::{ | ||
ba, bb, | ||
bc::bca::{bcaa, bcab}, | ||
}; | ||
use { | ||
a::{aa, ad::ada}, | ||
b, | ||
}; | ||
|
||
pub use { | ||
a::{aa, ae}, | ||
b::{bb, bc::bca}, | ||
}; | ||
use { | ||
a::{ab, ac, ad}, | ||
b::ba, | ||
}; | ||
|
||
use { | ||
a::{ | ||
aa::{aaa, *}, | ||
ab, | ||
ac::{aca, acb}, | ||
}, | ||
b::{ | ||
ba, | ||
bb::{self, bba}, | ||
}, | ||
}; | ||
|
||
use { | ||
crate::{a, b::ba}, | ||
c::ca, | ||
}; | ||
|
||
use { | ||
super::{a, b::ba}, | ||
c::ca, | ||
}; | ||
|
||
use { | ||
super::b, | ||
crate::a, | ||
c::{self, ca}, | ||
}; | ||
|
||
use { | ||
a::{ | ||
aa::{aaa, aab}, | ||
ab, | ||
ac::aca, | ||
ad::ada, | ||
}, | ||
b as x, | ||
}; |