Closed
Description
Extracted from #4655
A lint that detects let _
bindings of functions, that are must_use
:
#[must_use]
fn foo() -> u32 { 42 }
fn bar() -> Result<(), ()> { Ok(()) }
let _ = foo();
let _ = bar();
On how to detect must use #4655 (comment):
We have a check for
#[must_use]
types in functions.rs already (IIRCis_must_use_ty(cx, ty)
, we best move this toutils/mod.rs
), that you can call with the result of anexpr_ty(cx, _)
on the initializer.
Originally posted by @flip1995 in #4655 (comment)