-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
If you have an async function in a trait that does nothing by default:
trait MyTrait {
// having a body here makes its implementation optional
async fn completed(self, ...) {}
}
sure, the async
isn't used, but you want implementers to be able to use await in an overridden implementation. In this case, unused_async
should not be warned
Lint Name
unused_async
Reproducer
I tried this code:
pub trait Action {
// ...
async fn cancel(self: Arc<Self>) {}
}
I saw this happen:
clippy: unused `async` for function with no await statements
consider removing the `async` from this function
I expected to see this happen:
No warning
Version
rustc 1.88.0-nightly (0b45675cf 2025-03-31)
binary: rustc
commit-hash: 0b45675cfcec57f30a3794e1a1e18423aa9cf200
commit-date: 2025-03-31
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.1
Additional Labels
I-suggestion-causes-warning
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have