Skip to content

unused_async triggers on stubs with todo!() #15305

@trevoranderson

Description

@trevoranderson

Summary

Example code that triggers it

async fn unimplemented_task() -> Result<(), String> {
    todo!("Implement task");
}
warning: unused `async` for function with no await statements
    = help: consider removing the `async` from this function
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_async
    = note: `-W clippy::unused-async` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::unused_async)]`

I expected that todo!() or unimplemented!() would silence the lint. The fix isn't helpful since the stubbed code will eventually be async, is awaited by other partially implemented code, and has the defacto type of never.

Lint Name

No response

Reproducer

I tried this code:

<code>

I saw this happen:

<output>

I expected to see this happen:

Version


Additional Labels

No response

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions