From 8dc94a452cb908e789c926255146d1b4bf6682fb Mon Sep 17 00:00:00 2001 From: TomasKralCZ Date: Sun, 19 Jan 2020 17:39:53 +0100 Subject: fix typo in 'inline_local_variable' --- .../src/assists/inline_local_variable.rs | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'crates/ra_assists/src/assists') diff --git a/crates/ra_assists/src/assists/inline_local_variable.rs b/crates/ra_assists/src/assists/inline_local_variable.rs index 45e0f983f..d0c5c3b8c 100644 --- a/crates/ra_assists/src/assists/inline_local_variable.rs +++ b/crates/ra_assists/src/assists/inline_local_variable.rs @@ -23,7 +23,7 @@ use crate::{Assist, AssistCtx, AssistId}; // (1 + 2) * 4; // } // ``` -pub(crate) fn inline_local_varialbe(ctx: AssistCtx) -> Option { +pub(crate) fn inline_local_variable(ctx: AssistCtx) -> Option { let let_stmt = ctx.find_node_at_offset::()?; let bind_pat = match let_stmt.pat()? { ast::Pat::BindPat(pat) => pat, @@ -117,7 +117,7 @@ mod tests { #[test] fn test_inline_let_bind_literal_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn bar(a: usize) {} fn foo() { @@ -151,7 +151,7 @@ fn foo() { #[test] fn test_inline_let_bind_bin_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn bar(a: usize) {} fn foo() { @@ -185,7 +185,7 @@ fn foo() { #[test] fn test_inline_let_bind_function_call_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn bar(a: usize) {} fn foo() { @@ -219,7 +219,7 @@ fn foo() { #[test] fn test_inline_let_bind_cast_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn bar(a: usize): usize { a } fn foo() { @@ -253,7 +253,7 @@ fn foo() { #[test] fn test_inline_let_bind_block_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = { 10 + 1 }; @@ -285,7 +285,7 @@ fn foo() { #[test] fn test_inline_let_bind_paren_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = ( 10 + 1 ); @@ -317,7 +317,7 @@ fn foo() { #[test] fn test_not_inline_mut_variable() { check_assist_not_applicable( - inline_local_varialbe, + inline_local_variable, " fn foo() { let mut a<|> = 1 + 1; @@ -329,7 +329,7 @@ fn foo() { #[test] fn test_call_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = bar(10 + 1); @@ -347,7 +347,7 @@ fn foo() { #[test] fn test_index_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let x = vec![1, 2, 3]; @@ -367,7 +367,7 @@ fn foo() { #[test] fn test_method_call_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let bar = vec![1]; @@ -387,7 +387,7 @@ fn foo() { #[test] fn test_field_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " struct Bar { foo: usize @@ -415,7 +415,7 @@ fn foo() { #[test] fn test_try_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() -> Option { let bar = Some(1); @@ -437,7 +437,7 @@ fn foo() -> Option { #[test] fn test_ref_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let bar = 10; @@ -455,7 +455,7 @@ fn foo() { #[test] fn test_tuple_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = (10, 20); @@ -471,7 +471,7 @@ fn foo() { #[test] fn test_array_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = [1, 2, 3]; @@ -487,7 +487,7 @@ fn foo() { #[test] fn test_paren() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = (10 + 20); @@ -505,7 +505,7 @@ fn foo() { #[test] fn test_path_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let d = 10; @@ -525,7 +525,7 @@ fn foo() { #[test] fn test_block_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = { 10 }; @@ -543,7 +543,7 @@ fn foo() { #[test] fn test_used_in_different_expr1() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = 10 + 20; @@ -565,7 +565,7 @@ fn foo() { #[test] fn test_used_in_for_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = vec![10, 20]; @@ -581,7 +581,7 @@ fn foo() { #[test] fn test_used_in_while_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = 1 > 0; @@ -597,7 +597,7 @@ fn foo() { #[test] fn test_used_in_break_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = 1 + 1; @@ -617,7 +617,7 @@ fn foo() { #[test] fn test_used_in_return_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = 1 > 0; @@ -633,7 +633,7 @@ fn foo() { #[test] fn test_used_in_match_expr() { check_assist( - inline_local_varialbe, + inline_local_variable, " fn foo() { let a<|> = 1 > 0; -- cgit v1.2.3 From c3b9a19eb72ae9542272ae7a22ac3fb57c75daca Mon Sep 17 00:00:00 2001 From: TomasKralCZ Date: Sun, 19 Jan 2020 17:40:53 +0100 Subject: fix 'add_explicit_type' assist range --- crates/ra_assists/src/assists/add_explicit_type.rs | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'crates/ra_assists/src/assists') diff --git a/crates/ra_assists/src/assists/add_explicit_type.rs b/crates/ra_assists/src/assists/add_explicit_type.rs index f9f826b88..713abf910 100644 --- a/crates/ra_assists/src/assists/add_explicit_type.rs +++ b/crates/ra_assists/src/assists/add_explicit_type.rs @@ -1,7 +1,8 @@ use hir::{db::HirDatabase, HirDisplay}; use ra_syntax::{ ast::{self, AstNode, LetStmt, NameOwner}, - T, + SyntaxKind::EQ, + TextRange, T, }; use crate::{Assist, AssistCtx, AssistId}; @@ -34,6 +35,14 @@ pub(crate) fn add_explicit_type(ctx: AssistCtx) -> Option) -> Option