Summary
needless_return_with_question_mark is not triggering in async functions.
Lint Name
needless_return_with_question_mark
Reproducer
I tried this code (link to playground:
extern crate thiserror; // 2.0.18
extern crate tokio; // 1.52.0
fn result_fn1() -> Result<(), ()> {
if true {
return Err(())?;
}
Ok(())
}
async fn result_fn2() -> Result<(), ()> {
if true {
return Err(())?;
}
Ok(())
}
#[tokio::main]
async fn main() {
let _ = result_fn1();
let _ = result_fn2().await;
}
I expected to see this happen:
Lint is triggering on both result_fn1 and result_fn2
Instead, this happened:
it triggered only on result_fn1 .
Version
rustc 1.93.0 (254b59607 2026-01-19)
binary: rustc
commit-hash: 254b59607d4417e9dffbc307138ae5c86280fe4c
commit-date: 2026-01-19
host: aarch64-apple-darwin
release: 1.93.0
LLVM version: 21.1.8
Summary
needless_return_with_question_markis not triggering inasyncfunctions.Lint Name
needless_return_with_question_mark
Reproducer
I tried this code (link to playground:
I expected to see this happen:
Lint is triggering on both
result_fn1andresult_fn2Instead, this happened:
it triggered only on
result_fn1.Version