#17831·rust-clippy

automatic fix tries to remove #[async_recursion] annotation

Author: pacakCreated Oct 1, 2026Updated Oct 1, 2026
LabelsC-buggood first issueI-suggestion-causes-errorI-false-positiveD-confusing

Summary

You were the Chosen One! It was said that you would destroy the Sith, not join them!

Clippy tries to break perfectly working code then fails.

Reproducer

Code:

toml
[dependencies]
async-recursion = "=1.1.1"
rust
#[async_recursion::async_recursion]
pub async fn f() {
    f().await
}

Current output:

error: errors present after applying fixes to crate `clippy_repro_async_recursion`
 --> src/lib.rs
  = cause: error[E0733]: recursion in an async fn requires boxing
            --> src/lib.rs:1:1
             |
           1 | pub async fn f() {
             | ^^^^^^^^^^^^^^^^
           2 |     f().await
             |     --------- recursive call here
             |
             = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future


           error: aborting due to 1 previous error


           For more information about this error, try `rustc --explain E0733`.
help: to report this as a bug, open an issue at https://github.com/rust-lang/rust-clippy/issues, quoting the full output of this command
help: to possibly apply more fixes, pass in the `--broken-code` flag
note: original diagnostics will follow:
warning: this function has a `#[must_use]` attribute with no message, but returns a type already considered as `#[must_use]`
 --> src/lib.rs:1:36
  |
1 |   #[async_recursion::async_recursion]
  |  _-----------------------------------^
  | | |
  | | help: remove the attribute
2 | | pub async fn f() {
  | |_^
  |
note: the return type is pinned boxed `std::future::Future` trait object
 --> src/lib.rs:1:1
  |
1 | #[async_recursion::async_recursion]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: alternatively, you may add an explicit reason to the `must_use` attribute
  = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#double_must_use
  = note: `#[warn(clippy::double_must_use)]` on by default
  = note: this warning originates in the attribute macro `async_recursion::async_recursion` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `clippy-repro-async-recursion` (lib) generated 1 warning (run `cargo clippy --fix --lib -p clippy-repro-async-recursion -- --no-deps` to apply 1 suggestion)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s

Desired output:

Nothing?

Version

rustc 1.99.0 (b940084d7 2026-09-28)
binary: rustc
commit-hash: b940084d7eb6a299eb4bfeb8e34901bc051e7ac4
commit-date: 2026-09-28
host: x86_64-unknown-linux-gnu
release: 1.99.0
LLVM version: 23.1.1

Additional Labels

No response