Skip to content

Commit 6c9d2ad

Browse files
committed
test: add test case for remove comma
1 parent 2426d42 commit 6c9d2ad

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

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

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,111 @@ mod b {
609609
);
610610
}
611611

612+
#[test]
613+
fn remove_comma_after_auto_remove_brace() {
614+
check_assist(
615+
remove_unused_imports,
616+
r#"
617+
mod m {
618+
pub mod x {
619+
pub struct A;
620+
pub struct B;
621+
}
622+
pub mod y {
623+
pub struct C;
624+
}
625+
}
626+
627+
$0use m::{
628+
x::{A, B},
629+
y::C,
630+
};$0
631+
632+
fn main() {
633+
B;
634+
}
635+
"#,
636+
r#"
637+
mod m {
638+
pub mod x {
639+
pub struct A;
640+
pub struct B;
641+
}
642+
pub mod y {
643+
pub struct C;
644+
}
645+
}
646+
647+
use m::
648+
x::B
649+
;
650+
651+
fn main() {
652+
B;
653+
}
654+
"#,
655+
);
656+
check_assist(
657+
remove_unused_imports,
658+
r#"
659+
mod m {
660+
pub mod x {
661+
pub struct A;
662+
pub struct B;
663+
}
664+
pub mod y {
665+
pub struct C;
666+
pub struct D;
667+
}
668+
pub mod z {
669+
pub struct E;
670+
pub struct F;
671+
}
672+
}
673+
674+
$0use m::{
675+
x::{A, B},
676+
y::{C, D,},
677+
z::{E, F},
678+
};$0
679+
680+
fn main() {
681+
B;
682+
C;
683+
F;
684+
}
685+
"#,
686+
r#"
687+
mod m {
688+
pub mod x {
689+
pub struct A;
690+
pub struct B;
691+
}
692+
pub mod y {
693+
pub struct C;
694+
pub struct D;
695+
}
696+
pub mod z {
697+
pub struct E;
698+
pub struct F;
699+
}
700+
}
701+
702+
use m::{
703+
x::B,
704+
y::C,
705+
z::F,
706+
};
707+
708+
fn main() {
709+
B;
710+
C;
711+
F;
712+
}
713+
"#,
714+
);
715+
}
716+
612717
#[test]
613718
fn remove_nested_all_unused() {
614719
check_assist(

0 commit comments

Comments
 (0)