Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fcc6133

Browse files
committed
Remove alias definition naively
1 parent afa374e commit fcc6133

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use crate::{
3131
// ```
3232
// ->
3333
// ```
34-
// type A = i32;
34+
//
3535
// fn id(x: i32) -> i32 {
3636
// x
3737
// };
@@ -84,6 +84,9 @@ pub(crate) fn inline_type_alias_uses(acc: &mut Assists, ctx: &AssistContext<'_>)
8484
for (file_id, refs) in usages.into_iter() {
8585
inline_refs_for_file(file_id, refs);
8686
}
87+
88+
builder.edit_file(ctx.file_id());
89+
builder.delete(ast_alias.syntax().text_range());
8790
},
8891
)
8992
}
@@ -929,7 +932,7 @@ fn foo() {
929932
}
930933
"#,
931934
r#"
932-
type A = u32;
935+
933936
934937
fn foo() {
935938
let _: u32 = 3;
@@ -960,7 +963,7 @@ fn foo() {
960963
r#"
961964
//- /lib.rs
962965
mod foo;
963-
type T<E> = Vec<E>;
966+
964967
fn f() -> Vec<&str> {
965968
vec!["hello"]
966969
}

crates/ide-assists/src/tests/generated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ fn foo() {
13901390
}
13911391
"#####,
13921392
r#####"
1393-
type A = i32;
1393+
13941394
fn id(x: i32) -> i32 {
13951395
x
13961396
};

0 commit comments

Comments
 (0)