aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/assists/early_return.rs2
-rw-r--r--crates/ra_assists/src/assists/inline_local_variable.rs6
-rw-r--r--crates/ra_assists/src/assists/raw_string.rs2
3 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_assists/src/assists/early_return.rs b/crates/ra_assists/src/assists/early_return.rs
index e839d831e..ad6c5695a 100644
--- a/crates/ra_assists/src/assists/early_return.rs
+++ b/crates/ra_assists/src/assists/early_return.rs
@@ -50,7 +50,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx<impl HirDatabase>) -> Opt
50 } 50 }
51 51
52 // check for early return and continue 52 // check for early return and continue
53 let first_in_then_block = then_block.syntax().first_child()?.clone(); 53 let first_in_then_block = then_block.syntax().first_child()?;
54 if ast::ReturnExpr::can_cast(first_in_then_block.kind()) 54 if ast::ReturnExpr::can_cast(first_in_then_block.kind())
55 || ast::ContinueExpr::can_cast(first_in_then_block.kind()) 55 || ast::ContinueExpr::can_cast(first_in_then_block.kind())
56 || first_in_then_block 56 || first_in_then_block
diff --git a/crates/ra_assists/src/assists/inline_local_variable.rs b/crates/ra_assists/src/assists/inline_local_variable.rs
index f43910574..a7fd9b6d2 100644
--- a/crates/ra_assists/src/assists/inline_local_variable.rs
+++ b/crates/ra_assists/src/assists/inline_local_variable.rs
@@ -51,10 +51,8 @@ pub(crate) fn inline_local_varialbe(ctx: AssistCtx<impl HirDatabase>) -> Option<
51 let mut wrap_in_parens = vec![true; refs.len()]; 51 let mut wrap_in_parens = vec![true; refs.len()];
52 52
53 for (i, desc) in refs.iter().enumerate() { 53 for (i, desc) in refs.iter().enumerate() {
54 let usage_node = ctx 54 let usage_node =
55 .covering_node_for_range(desc.range) 55 ctx.covering_node_for_range(desc.range).ancestors().find_map(ast::PathExpr::cast)?;
56 .ancestors()
57 .find_map(|node| ast::PathExpr::cast(node))?;
58 let usage_parent_option = usage_node.syntax().parent().and_then(ast::Expr::cast); 56 let usage_parent_option = usage_node.syntax().parent().and_then(ast::Expr::cast);
59 let usage_parent = match usage_parent_option { 57 let usage_parent = match usage_parent_option {
60 Some(u) => u, 58 Some(u) => u,
diff --git a/crates/ra_assists/src/assists/raw_string.rs b/crates/ra_assists/src/assists/raw_string.rs
index 6f4b66c31..58f7157ae 100644
--- a/crates/ra_assists/src/assists/raw_string.rs
+++ b/crates/ra_assists/src/assists/raw_string.rs
@@ -131,7 +131,7 @@ pub(crate) fn remove_hash(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
131 ctx.add_assist(AssistId("remove_hash"), "remove hash from raw string", |edit| { 131 ctx.add_assist(AssistId("remove_hash"), "remove hash from raw string", |edit| {
132 edit.target(token.text_range()); 132 edit.target(token.text_range());
133 let result = &text[2..text.len() - 1]; 133 let result = &text[2..text.len() - 1];
134 let result = if result.starts_with("\"") { 134 let result = if result.starts_with('\"') {
135 // no more hash, escape 135 // no more hash, escape
136 let internal_str = &result[1..result.len() - 1]; 136 let internal_str = &result[1..result.len() - 1];
137 format!("\"{}\"", internal_str.escape_default().to_string()) 137 format!("\"{}\"", internal_str.escape_default().to_string())