Skip to content

Commit

Permalink
Preserve attributes for imports_granularity=Item
Browse files Browse the repository at this point in the history
  • Loading branch information
narpfel committed Oct 17, 2021
1 parent c9c1932 commit 35a4edc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ impl UseTree {
span: self.span,
list_item: None,
visibility: self.visibility.clone(),
attrs: None,
attrs: self.attrs.clone(),
});
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/source/issue-5030.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// rustfmt-imports_granularity: Item

#[cfg(feature = "foo")]
use std::collections::{
HashMap,
HashSet,
};
6 changes: 6 additions & 0 deletions tests/target/issue-5030.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// rustfmt-imports_granularity: Item

#[cfg(feature = "foo")]
use std::collections::HashMap;
#[cfg(feature = "foo")]
use std::collections::HashSet;

0 comments on commit 35a4edc

Please sign in to comment.