rustc should probably warn on anonymous, unused closure statement #74691
Labels
A-closures
Area: Closures (`|…| { … }`)
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
Not quite sure how to name this issue, please change the title to something more accurate!
Recently ran into this issue:
The boolean statement was long, so I broke it out onto a new line. However, I accidentally added the annotated semi-colon. The
|| true
line is interpreted as an anonymous closure statement (no let binding, not even a callable closure) as opposed to a boolean OR.When executing this code, it yields
false
. Luckily, someone caught the issue in code review, but a compiler warning noting the unused closure would have been really helpful!The text was updated successfully, but these errors were encountered: