vscode-rust icon indicating copy to clipboard operation
vscode-rust copied to clipboard

Light bulb to add async to function

Open vanillajonathan opened this issue 4 years ago • 0 comments

await is only allowed inside async functions and blocks

only allowed inside async functions and blocksrustc(E0728) main.rs(14, 8): this is not async main.rs(15, 20): only allowed inside async functions and blocks

Show a light bulb that gives the user the option to add "async" to the function.

Before:

pub fn foo() {
    TcpListener::bind("127.0.0.1:8080").await?;
}

After:

pub async fn foo() {
    TcpListener::bind("127.0.0.1:8080").await?;
}

vanillajonathan avatar Aug 26 '21 20:08 vanillajonathan