aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_assists/src')
-rw-r--r--crates/ide_assists/src/handlers/extract_function.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs
index ac7f0959b..62edc4850 100644
--- a/crates/ide_assists/src/handlers/extract_function.rs
+++ b/crates/ide_assists/src/handlers/extract_function.rs
@@ -994,6 +994,9 @@ fn format_replacement(ctx: &AssistContext, fun: &Function, indent: IndentLevel)
994 } 994 }
995 } 995 }
996 format_to!(buf, "{}", expr); 996 format_to!(buf, "{}", expr);
997 if body_contains_await(&fun.body) {
998 buf.push_str(".await");
999 }
997 if fun.ret_ty.is_unit() 1000 if fun.ret_ty.is_unit()
998 && (!fun.vars_defined_in_body_and_outlive.is_empty() || !expr.is_block_like()) 1001 && (!fun.vars_defined_in_body_and_outlive.is_empty() || !expr.is_block_like())
999 { 1002 {
@@ -3681,7 +3684,7 @@ async fn some_function() {
3681"#, 3684"#,
3682 r#" 3685 r#"
3683fn main() { 3686fn main() {
3684 fun_name(); 3687 fun_name().await;
3685} 3688}
3686 3689
3687async fn $0fun_name() { 3690async fn $0fun_name() {
@@ -3710,7 +3713,7 @@ async fn some_function() {
3710"#, 3713"#,
3711 r#" 3714 r#"
3712fn main() { 3715fn main() {
3713 fun_name(); 3716 fun_name().await;
3714} 3717}
3715 3718
3716async fn $0fun_name() { 3719async fn $0fun_name() {