mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Fix extract_function with await
This commit is contained in:
parent
3898387f3b
commit
cd1ef8de18
1 changed files with 5 additions and 2 deletions
|
@ -994,6 +994,9 @@ fn format_replacement(ctx: &AssistContext, fun: &Function, indent: IndentLevel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
format_to!(buf, "{}", expr);
|
format_to!(buf, "{}", expr);
|
||||||
|
if body_contains_await(&fun.body) {
|
||||||
|
buf.push_str(".await");
|
||||||
|
}
|
||||||
if fun.ret_ty.is_unit()
|
if fun.ret_ty.is_unit()
|
||||||
&& (!fun.vars_defined_in_body_and_outlive.is_empty() || !expr.is_block_like())
|
&& (!fun.vars_defined_in_body_and_outlive.is_empty() || !expr.is_block_like())
|
||||||
{
|
{
|
||||||
|
@ -3681,7 +3684,7 @@ async fn some_function() {
|
||||||
"#,
|
"#,
|
||||||
r#"
|
r#"
|
||||||
fn main() {
|
fn main() {
|
||||||
fun_name();
|
fun_name().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn $0fun_name() {
|
async fn $0fun_name() {
|
||||||
|
@ -3710,7 +3713,7 @@ async fn some_function() {
|
||||||
"#,
|
"#,
|
||||||
r#"
|
r#"
|
||||||
fn main() {
|
fn main() {
|
||||||
fun_name();
|
fun_name().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn $0fun_name() {
|
async fn $0fun_name() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue