Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ impl UseTree {
if let UseSegmentKind::List(list) = last.kind {
let mut list = list.into_iter().map(UseTree::normalize).collect::<Vec<_>>();
list.sort();
list.dedup();
last = UseSegment {
kind: UseSegmentKind::List(list),
style_edition: last.style_edition,
Expand Down Expand Up @@ -827,6 +828,7 @@ fn merge_rest(
UseTree::from_path(b[len..].to_vec(), DUMMY_SP),
];
list.sort();
list.dedup();
let mut new_path = b[..len].to_vec();
let kind = UseSegmentKind::List(list);
let style_edition = a[0].style_edition;
Expand Down Expand Up @@ -891,6 +893,7 @@ fn merge_use_trees_inner(trees: &mut Vec<UseTree>, use_tree: UseTree, merge_by:
}
trees.push(use_tree);
trees.sort();
trees.dedup();
}

impl Hash for UseTree {
Expand Down
4 changes: 4 additions & 0 deletions tests/source/issue-6243.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// rustfmt-imports_granularity: Module

use risingwave_batch::executor::{BoxedExecutor, JoinType};
use risingwave_batch::executor::{BoxedExecutor, JoinType};
3 changes: 3 additions & 0 deletions tests/target/issue-6243.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// rustfmt-imports_granularity: Module

use risingwave_batch::executor::{BoxedExecutor, JoinType};
6 changes: 1 addition & 5 deletions tests/target/multiple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ extern crate foo;
extern crate foo;

use std::cell::*;
use std::{
self, any, ascii, borrow, borrow, borrow, borrow, borrow, borrow, borrow, borrow, borrow,
borrow, borrow, boxed, boxed, boxed, boxed, boxed, boxed, boxed, boxed, boxed, boxed, char,
char, char, char, char, char, char, char, char, char,
};
use std::{self, any, ascii, borrow, boxed, char};

mod doc;
mod other;
Expand Down
Loading