Skip to content

Commit e222434

Browse files
committed
chore: add test case for nested use tree
1 parent c84f639 commit e222434

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

crates/ide-assists/src/handlers/remove_unused_imports.rs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,79 @@ mod y {
536536
);
537537
}
538538

539+
#[test]
540+
fn remove_unused_auto_remove_brace_nested() {
541+
check_assist(
542+
remove_unused_imports,
543+
r#"
544+
mod a {
545+
pub struct A();
546+
}
547+
mod b {
548+
struct F();
549+
mod c {
550+
$0use {{super::{{
551+
{d::{{{{{{{S, U}}}}}}}},
552+
{{{{e::{H, L, {{{R}}}}}}}},
553+
F, super::a::A
554+
}}}};$0
555+
fn f() {
556+
let f = F();
557+
let l = L();
558+
let a = A();
559+
let s = S();
560+
let h = H();
561+
}
562+
}
563+
564+
mod d {
565+
pub struct S();
566+
pub struct U();
567+
}
568+
569+
mod e {
570+
pub struct H();
571+
pub struct L();
572+
pub struct R();
573+
}
574+
}
575+
"#,
576+
r#"
577+
mod a {
578+
pub struct A();
579+
}
580+
mod b {
581+
struct F();
582+
mod c {
583+
use super::{
584+
d::S,
585+
e::{H, L},
586+
F, super::a::A
587+
};
588+
fn f() {
589+
let f = F();
590+
let l = L();
591+
let a = A();
592+
let s = S();
593+
let h = H();
594+
}
595+
}
596+
597+
mod d {
598+
pub struct S();
599+
pub struct U();
600+
}
601+
602+
mod e {
603+
pub struct H();
604+
pub struct L();
605+
pub struct R();
606+
}
607+
}
608+
"#,
609+
);
610+
}
611+
539612
#[test]
540613
fn remove_nested_all_unused() {
541614
check_assist(

0 commit comments

Comments
 (0)