needless_return doesn't trigger properly with anyhow!
macro
#10051
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-negative
Issue: The lint should have been triggered on code, but wasn't
Summary
needless_return fails to trigger on
return Err(anyhow::anyhow!("failed to do things"));
This leads to weird situations where clippy will clean up one needless return but not another, for example https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b196ba185e8485558293b61fce4f7d7c . I saw this a fair bit when running
clippy --fix
across the fuchsia codebase, http://fxrev.dev/c/fuchsia/+/773265/2..3 shows me manually fixing up those cases.Lint Name
needless_return
Reproducer
I tried this code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0952e8cbe8416c99f9a5b1e7c44c1c56
I expected to see this happen:
Instead, this happened (no errors):
Version
The text was updated successfully, but these errors were encountered: