aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/handlers
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-07 16:32:01 +0100
committerAleksey Kladov <[email protected]>2020-05-07 16:32:01 +0100
commit1e790ea3149f085e49cb66e6a052920f72da01e9 (patch)
tree0a036aeb11785ab638c809614daa66e5dd1133b4 /crates/ra_assists/src/handlers
parent28fcff125a73ab2fc4aeaa100fc472af5178db20 (diff)
Simplify
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r--crates/ra_assists/src/handlers/early_return.rs2
-rw-r--r--crates/ra_assists/src/handlers/merge_imports.rs2
-rw-r--r--crates/ra_assists/src/handlers/merge_match_arms.rs2
-rw-r--r--crates/ra_assists/src/handlers/split_import.rs2
4 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_assists/src/handlers/early_return.rs b/crates/ra_assists/src/handlers/early_return.rs
index ccf91797c..810784ad5 100644
--- a/crates/ra_assists/src/handlers/early_return.rs
+++ b/crates/ra_assists/src/handlers/early_return.rs
@@ -93,7 +93,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
93 } 93 }
94 94
95 then_block.syntax().last_child_or_token().filter(|t| t.kind() == R_CURLY)?; 95 then_block.syntax().last_child_or_token().filter(|t| t.kind() == R_CURLY)?;
96 let cursor_position = ctx.frange.range.start(); 96 let cursor_position = ctx.offset();
97 97
98 let target = if_expr.syntax().text_range(); 98 let target = if_expr.syntax().text_range();
99 acc.add(AssistId("convert_to_guarded_return"), "Convert to guarded return", target, |edit| { 99 acc.add(AssistId("convert_to_guarded_return"), "Convert to guarded return", target, |edit| {
diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs
index 8e1d93312..ac3e53c27 100644
--- a/crates/ra_assists/src/handlers/merge_imports.rs
+++ b/crates/ra_assists/src/handlers/merge_imports.rs
@@ -26,7 +26,7 @@ use crate::{
26pub(crate) fn merge_imports(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { 26pub(crate) fn merge_imports(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
27 let tree: ast::UseTree = ctx.find_node_at_offset()?; 27 let tree: ast::UseTree = ctx.find_node_at_offset()?;
28 let mut rewriter = SyntaxRewriter::default(); 28 let mut rewriter = SyntaxRewriter::default();
29 let mut offset = ctx.frange.range.start(); 29 let mut offset = ctx.offset();
30 30
31 if let Some(use_item) = tree.syntax().parent().and_then(ast::UseItem::cast) { 31 if let Some(use_item) = tree.syntax().parent().and_then(ast::UseItem::cast) {
32 let (merged, to_delete) = next_prev() 32 let (merged, to_delete) = next_prev()
diff --git a/crates/ra_assists/src/handlers/merge_match_arms.rs b/crates/ra_assists/src/handlers/merge_match_arms.rs
index cfe4df47b..d4e38aa6a 100644
--- a/crates/ra_assists/src/handlers/merge_match_arms.rs
+++ b/crates/ra_assists/src/handlers/merge_match_arms.rs
@@ -45,7 +45,7 @@ pub(crate) fn merge_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option
45 InExpr(TextSize), 45 InExpr(TextSize),
46 InPat(TextSize), 46 InPat(TextSize),
47 } 47 }
48 let cursor_pos = ctx.frange.range.start(); 48 let cursor_pos = ctx.offset();
49 let cursor_pos = if current_expr.syntax().text_range().contains(cursor_pos) { 49 let cursor_pos = if current_expr.syntax().text_range().contains(cursor_pos) {
50 CursorPos::InExpr(current_text_range.end() - cursor_pos) 50 CursorPos::InExpr(current_text_range.end() - cursor_pos)
51 } else { 51 } else {
diff --git a/crates/ra_assists/src/handlers/split_import.rs b/crates/ra_assists/src/handlers/split_import.rs
index 159033731..b2757e50c 100644
--- a/crates/ra_assists/src/handlers/split_import.rs
+++ b/crates/ra_assists/src/handlers/split_import.rs
@@ -26,7 +26,7 @@ pub(crate) fn split_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
26 if new_tree == use_tree { 26 if new_tree == use_tree {
27 return None; 27 return None;
28 } 28 }
29 let cursor = ctx.frange.range.start(); 29 let cursor = ctx.offset();
30 30
31 let target = colon_colon.text_range(); 31 let target = colon_colon.text_range();
32 acc.add(AssistId("split_import"), "Split import", target, |edit| { 32 acc.add(AssistId("split_import"), "Split import", target, |edit| {