Open
Description
One IRC today, someone had code not working because they were doing
thread::spawn(|| mylib::my_function);
Which of course returns the function rather than running it.
Arguably it's almost always mistake to not keep the JoinHandle if the thread is going to return a non-unit value, since if you didn't care the closure could just be -> ()
, so this should lint, but AFAIK #[must_use]
on the function or type would warn for JoinHandle<()>
too today.
Repro link: https://play.rust-lang.org/?gist=fd8973579bf0bf474a7e2b9e135ff946&version=nightly