#![deny(async_await_code)]

Hi all,

We have a relatively large codebase that currently doesn't fit with the use of async / await. Currently we therefor already ban both tokio and async-std from our codebase through the use of cargo-deny to keep our dependencies from using these large runtimes and spawning new threads behind our back.

However, this doesn't preclude our team from still trying to use async/await (though potentially lighter runtimes) in our codebase. I started looking for a way to explicitly ban async/await similar to how we're explicitly banning unsafe_code in some parts of our code, but couldn't find any (rustc -W help didn't show anything relevant on 1.64).

I think a case similar to banning unsafe code through lints can be made for async/await as well, hence I'm proposing it here.

1 Like

Can you elaborate some on what that case may be? At its core, Rust’s async system is just a stack machine ⇒ state machine translator and it’s up to the executor to do anything particularly special with the result. My imagination isn’t good enough to see why this might be a technique that a codebase should ban.

13 Likes

This might be more appropriate as a Clippy restriction lint.

12 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.