aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ide_assists/src/handlers/extract_variable.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ide_assists/src/handlers/extract_variable.rs b/crates/ide_assists/src/handlers/extract_variable.rs
index 32e54fd57..2c47be987 100644
--- a/crates/ide_assists/src/handlers/extract_variable.rs
+++ b/crates/ide_assists/src/handlers/extract_variable.rs
@@ -176,9 +176,9 @@ impl Anchor {
176 176
177fn suggest_variable_name(ctx: &AssistContext, expr: &ast::Expr) -> String { 177fn suggest_variable_name(ctx: &AssistContext, expr: &ast::Expr) -> String {
178 // FIXME: account for existing names in the scope 178 // FIXME: account for existing names in the scope
179 suggest_name_from_func(expr) 179 suggest_name_from_param(ctx, expr)
180 .or_else(|| suggest_name_from_func(expr))
180 .or_else(|| suggest_name_from_method(expr)) 181 .or_else(|| suggest_name_from_method(expr))
181 .or_else(|| suggest_name_from_param(ctx, expr))
182 .or_else(|| suggest_name_by_type(ctx, expr)) 182 .or_else(|| suggest_name_by_type(ctx, expr))
183 .unwrap_or_else(|| "var_name".to_string()) 183 .unwrap_or_else(|| "var_name".to_string())
184} 184}
@@ -815,7 +815,7 @@ fn foo() {
815 } 815 }
816 816
817 #[test] 817 #[test]
818 fn extract_var_function_name_has_precedence() { 818 fn extract_var_parameter_name_has_precedence_over_function() {
819 check_assist( 819 check_assist(
820 extract_variable, 820 extract_variable,
821 r#" 821 r#"
@@ -829,8 +829,8 @@ fn foo() {
829fn bar(test: u32, size: u32) 829fn bar(test: u32, size: u32)
830 830
831fn foo() { 831fn foo() {
832 let $0symbol_size = symbol_size(1, 2); 832 let $0size = symbol_size(1, 2);
833 bar(1, symbol_size); 833 bar(1, size);
834} 834}
835"#, 835"#,
836 ) 836 )