Skip to content

Commit

Permalink
[review] check interaction with import grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
tommilligan authored and calebcartwright committed Apr 17, 2022
1 parent 9b1b3d6 commit acdab00
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/source/issue-5030.rs
Original file line number Diff line number Diff line change
@@ -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};
15 changes: 15 additions & 0 deletions tests/target/issue-5030.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down

0 comments on commit acdab00

Please sign in to comment.