RS.CLIPPY.UNUSED_ASYNC
Finds async functions with no await statements
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: unused_async. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for functions that are declared async but have no .awaits inside of them.
Why is this bad?
Async functions with no async code create overhead, both mentally and computationally. Callers of async methods either need to be calling from an async function themselves or run it on an executor, both of which causes runtime overhead and hassle for the caller.
Example
async fn get_random_number() -> i64 {
4 // Chosen by fair dice roll. Guaranteed to be random.
}
let number_future = get_random_number();
Use instead:
fn get_random_number_improved() -> i64 {
4 // Chosen by fair dice roll. Guaranteed to be random.
}
let number_future = async { get_random_number_improved() };