about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTom Milligan <tom@reinfer.io>2022-04-16 12:12:27 +0100
committerCaleb Cartwright <calebcartwright@users.noreply.github.com>2022-04-17 09:28:48 -0500
commitacdab00ecc4c5064b6a42f87a523961304678c06 (patch)
treec5f10da70552a66bb2813430478f5102b8e71cb3
parent9b1b3d69559750cf459638076dc32202110ec40e (diff)
downloadrust-acdab00ecc4c5064b6a42f87a523961304678c06.tar.gz
rust-acdab00ecc4c5064b6a42f87a523961304678c06.zip
[review] check interaction with import grouping
-rw-r--r--tests/source/issue-5030.rs15
-rw-r--r--tests/target/issue-5030.rs15
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/source/issue-5030.rs b/tests/source/issue-5030.rs
index f367e79f01f..08ffaac7d1d 100644
--- a/tests/source/issue-5030.rs
+++ b/tests/source/issue-5030.rs
@@ -1,7 +1,22 @@
 // rustfmt-imports_granularity: Item
+// rustfmt-group_imports: One
 
+// Confirm that attributes are duplicated to all items in the use statement
 #[cfg(feature = "foo")]
 use std::collections::{
     HashMap,
     HashSet,
 };
+
+// Separate the imports below from the ones above
+const A: usize = 0;
+
+// Copying attrs works with import grouping as well
+#[cfg(feature = "foo")]
+use std::collections::{
+    HashMap,
+    HashSet,
+};
+
+#[cfg(feature = "spam")]
+use qux::{bar, baz};
diff --git a/tests/target/issue-5030.rs b/tests/target/issue-5030.rs
index b371331ed00..8ac3888bdbe 100644
--- a/tests/target/issue-5030.rs
+++ b/tests/target/issue-5030.rs
@@ -1,5 +1,20 @@
 // rustfmt-imports_granularity: Item
+// rustfmt-group_imports: One
 
+// Confirm that attributes are duplicated to all items in the use statement
+#[cfg(feature = "foo")]
+use std::collections::HashMap;
+#[cfg(feature = "foo")]
+use std::collections::HashSet;
+
+// Separate the imports below from the ones above
+const A: usize = 0;
+
+// Copying attrs works with import grouping as well
+#[cfg(feature = "spam")]
+use qux::bar;
+#[cfg(feature = "spam")]
+use qux::baz;
 #[cfg(feature = "foo")]
 use std::collections::HashMap;
 #[cfg(feature = "foo")]