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 (IIRC is_must_use_ty(cx, ty), we best move this to utils/mod.rs), that you can call with the result of an expr_ty(cx, _) on the initializer.
Originally posted by @flip1995 in #4655 (comment)