From fd6e11cc57da5728a9a52c0a515fd80e811a43d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Campinas?= Date: Wed, 2 Feb 2022 15:43:31 +0100 Subject: [PATCH] Add tests for the One and Crate variants --- tests/source/5131_crate.rs | 14 ++++++++++++++ tests/source/{5131.rs => 5131_module.rs} | 0 tests/source/5131_one.rs | 15 +++++++++++++++ tests/target/5131_crate.rs | 9 +++++++++ tests/target/{5131.rs => 5131_module.rs} | 0 tests/target/5131_one.rs | 12 ++++++++++++ 6 files changed, 50 insertions(+) create mode 100644 tests/source/5131_crate.rs rename tests/source/{5131.rs => 5131_module.rs} (100%) create mode 100644 tests/source/5131_one.rs create mode 100644 tests/target/5131_crate.rs rename tests/target/{5131.rs => 5131_module.rs} (100%) create mode 100644 tests/target/5131_one.rs diff --git a/tests/source/5131_crate.rs b/tests/source/5131_crate.rs new file mode 100644 index 00000000000..96a31659022 --- /dev/null +++ b/tests/source/5131_crate.rs @@ -0,0 +1,14 @@ +// rustfmt-imports_granularity: Crate + +use foo::a; +use foo::a; +use foo::b; +use foo::b as b2; +use foo::b::f; +use foo::b::g; +use foo::b::g as g2; +use foo::c; +use foo::d::e; +use qux::h; +use qux::h as h2; +use qux::i; diff --git a/tests/source/5131.rs b/tests/source/5131_module.rs similarity index 100% rename from tests/source/5131.rs rename to tests/source/5131_module.rs diff --git a/tests/source/5131_one.rs b/tests/source/5131_one.rs new file mode 100644 index 00000000000..61ddf13410d --- /dev/null +++ b/tests/source/5131_one.rs @@ -0,0 +1,15 @@ +// rustfmt-imports_granularity: One + +pub use foo::x; +pub use foo::x as x2; +pub use foo::y; +use bar::a; +use bar::b; +use bar::b::f; +use bar::b::f as f2; +use bar::b::g; +use bar::c; +use bar::d::e; +use bar::d::e as e2; +use qux::h; +use qux::i; diff --git a/tests/target/5131_crate.rs b/tests/target/5131_crate.rs new file mode 100644 index 00000000000..557d6670355 --- /dev/null +++ b/tests/target/5131_crate.rs @@ -0,0 +1,9 @@ +// rustfmt-imports_granularity: Crate + +use foo::{ + a, b, b as b2, + b::{f, g, g as g2}, + c, + d::e, +}; +use qux::{h, h as h2, i}; diff --git a/tests/target/5131.rs b/tests/target/5131_module.rs similarity index 100% rename from tests/target/5131.rs rename to tests/target/5131_module.rs diff --git a/tests/target/5131_one.rs b/tests/target/5131_one.rs new file mode 100644 index 00000000000..a086dae5a42 --- /dev/null +++ b/tests/target/5131_one.rs @@ -0,0 +1,12 @@ +// rustfmt-imports_granularity: One + +pub use foo::{x, x as x2, y}; +use { + bar::{ + a, + b::{self, f, g}, + c, + d::{e, e as e2}, + }, + qux::{h, i}, +};