summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/issue-5030.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rustfmt/tests/target/issue-5030.rs')
-rw-r--r--src/tools/rustfmt/tests/target/issue-5030.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/target/issue-5030.rs b/src/tools/rustfmt/tests/target/issue-5030.rs
new file mode 100644
index 000000000..8ac3888bd
--- /dev/null
+++ b/src/tools/rustfmt/tests/target/issue-5030.rs
@@ -0,0 +1,21 @@
+// 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")]
+use std::collections::HashSet;