Skip to content

Commit

Permalink
Add reorder_imports: false tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Jan 8, 2024
1 parent 5f96cf1 commit 660aa46
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// rustfmt-imports_granularity: ModuleCondensed
// rustfmt-reorder_imports: false

use a::{b::c, d::e};
use a::{f, g::{h, i}};
use a::{j::{self, k::{self, l}, m}, n::{o::p, q}};
pub use a::{r::s, t};
use b::{c::d, self};

#[cfg(test)]
use foo::{a::b, c::d};
use foo::e;

use bar::{
// comment
a::b,
// more comment
c::d,
e::f,
};

use b::{f::g, h::{i, j} /* After b::h group */};
use b::e;
use b::{/* Before b::l group */ l::{self, m, n::o, p::*}, q};
use b::d;
use b::r; // After b::r
use b::q::{self /* After b::q::self */};
use b::u::{
a,
b,
};
use b::t::{
// Before b::t::a
a,
b,
};
use b::s::{
a,
b, // After b::s::b
};
use b::v::{
// Before b::v::a
a,
// Before b::v::b
b,
};
use b::t::{/* Before b::t::self */ self};
use b::c;
48 changes: 48 additions & 0 deletions tests/source/imports/imports_granularity_module_no_reorder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// rustfmt-imports_granularity: Module
// rustfmt-reorder_imports: false

use a::{b::c, d::e};
use a::{f, g::{h, i}};
use a::{j::{self, k::{self, l}, m}, n::{o::p, q}};
pub use a::{r::s, t};
use b::{c::d, self};

#[cfg(test)]
use foo::{a::b, c::d};
use foo::e;

use bar::{
// comment
a::b,
// more comment
c::d,
e::f,
};

use b::{f::g, h::{i, j} /* After b::h group */};
use b::e;
use b::{/* Before b::l group */ l::{self, m, n::o, p::*}, q};
use b::d;
use b::r; // After b::r
use b::q::{self /* After b::q::self */};
use b::u::{
a,
b,
};
use b::t::{
// Before b::t::a
a,
b,
};
use b::s::{
a,
b, // After b::s::b
};
use b::v::{
// Before b::v::a
a,
// Before b::v::b
b,
};
use b::t::{/* Before b::t::self */ self};
use b::c;
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// rustfmt-imports_granularity: ModuleCondensed
// rustfmt-reorder_imports: false

use a::{b::c, d::e};
use a::{
f,
g::{h, i},
};
use a::{
j::{
self,
k::{self, l},
m,
},
n::{o::p, q},
};
pub use a::{r::s, t};
use b::{c::d, self};

#[cfg(test)]
use foo::{a::b, c::d};
use foo::e;

use bar::{
// comment
a::b,
// more comment
c::d,
e::f,
};

use b::{
f::g,
h::{i, j}, /* After b::h group */
};
use b::e;
use b::{
/* Before b::l group */ l::{self, m, n::o, p::*},
q,
};
use b::d;
use b::r; // After b::r
use b::q::{self /* After b::q::self */};
use b::u::{a, b};
use b::t::{
// Before b::t::a
a,
b,
};
use b::s::{
a,
b, // After b::s::b
};
use b::v::{
// Before b::v::a
a,
// Before b::v::b
b,
};
use b::t::{/* Before b::t::self */ self};
use b::c;
61 changes: 61 additions & 0 deletions tests/target/imports/imports_granularity_module_no_reorder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// rustfmt-imports_granularity: Module
// rustfmt-reorder_imports: false

use a::{b::c, d::e};
use a::{
f,
g::{h, i},
};
use a::{
j::{
self,
k::{self, l},
m,
},
n::{o::p, q},
};
pub use a::{r::s, t};
use b::{c::d, self};

#[cfg(test)]
use foo::{a::b, c::d};
use foo::e;

use bar::{
// comment
a::b,
// more comment
c::d,
e::f,
};

use b::{
f::g,
h::{i, j}, /* After b::h group */
};
use b::e;
use b::{
/* Before b::l group */ l::{self, m, n::o, p::*},
q,
};
use b::d;
use b::r; // After b::r
use b::q::{self /* After b::q::self */};
use b::u::{a, b};
use b::t::{
// Before b::t::a
a,
b,
};
use b::s::{
a,
b, // After b::s::b
};
use b::v::{
// Before b::v::a
a,
// Before b::v::b
b,
};
use b::t::{/* Before b::t::self */ self};
use b::c;

0 comments on commit 660aa46

Please sign in to comment.