Skip to content

Commit

Permalink
Merge pull request #70 from dtolnay/selfas
Browse files Browse the repository at this point in the history
Preserve braces in `use path::to::{self as rename};`
  • Loading branch information
dtolnay authored Mar 25, 2024
2 parents d8b3595 + a899304 commit 7f0aef1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,12 @@ impl Printer {
fn use_group(&mut self, use_group: &UseGroup) {
if use_group.items.is_empty() {
self.word("{}");
} else if use_group.items.len() == 1 {
} else if use_group.items.len() == 1
&& match &use_group.items[0] {
UseTree::Rename(use_rename) => use_rename.ident != "self",
_ => true,
}
{
self.use_tree(&use_group.items[0]);
} else {
self.cbox(INDENT);
Expand Down

0 comments on commit 7f0aef1

Please sign in to comment.