Skip to content

Commit a622b54

Browse files
committed
Don't set cursor in change_visibility
1 parent 74da16f commit a622b54

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

crates/ra_assists/src/handlers/change_visibility.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
6868

6969
acc.add(AssistId("change_visibility"), "Change visibility to pub(crate)", target, |edit| {
7070
edit.insert(offset, "pub(crate) ");
71-
edit.set_cursor(offset);
7271
})
7372
}
7473

@@ -92,7 +91,6 @@ fn change_vis(acc: &mut Assists, vis: ast::Visibility) -> Option<()> {
9291
target,
9392
|edit| {
9493
edit.replace(vis.syntax().text_range(), "pub(crate)");
95-
edit.set_cursor(vis.syntax().text_range().start())
9694
},
9795
);
9896
}
@@ -104,7 +102,6 @@ fn change_vis(acc: &mut Assists, vis: ast::Visibility) -> Option<()> {
104102
target,
105103
|edit| {
106104
edit.replace(vis.syntax().text_range(), "pub");
107-
edit.set_cursor(vis.syntax().text_range().start());
108105
},
109106
);
110107
}
@@ -122,15 +119,15 @@ mod tests {
122119
#[test]
123120
fn change_visibility_adds_pub_crate_to_items() {
124121
check_assist(change_visibility, "<|>fn foo() {}", "<|>pub(crate) fn foo() {}");
125-
check_assist(change_visibility, "f<|>n foo() {}", "<|>pub(crate) fn foo() {}");
122+
check_assist(change_visibility, "f<|>n foo() {}", "pub(crate) f<|>n foo() {}");
126123
check_assist(change_visibility, "<|>struct Foo {}", "<|>pub(crate) struct Foo {}");
127124
check_assist(change_visibility, "<|>mod foo {}", "<|>pub(crate) mod foo {}");
128125
check_assist(change_visibility, "<|>trait Foo {}", "<|>pub(crate) trait Foo {}");
129-
check_assist(change_visibility, "m<|>od {}", "<|>pub(crate) mod {}");
126+
check_assist(change_visibility, "m<|>od {}", "pub(crate) m<|>od {}");
130127
check_assist(
131128
change_visibility,
132129
"unsafe f<|>n foo() {}",
133-
"<|>pub(crate) unsafe fn foo() {}",
130+
"pub(crate) unsafe f<|>n foo() {}",
134131
);
135132
}
136133

0 commit comments

Comments
 (0)