I love the new let_underscore_lock lint that gives errors like
error: non-binding let on a synchronization lock
426 | let _ = lock.lock().unwrap();
| ^ ^^^^^^^^^^^^^^^^^^^^ this binding will immediately drop the value assigned to it
| this lock is not assigned to a binding and is immediately dropped
= note: `#[deny(let_underscore_lock)]` on by default
help: consider binding to an unused variable to avoid immediately dropping the value
426 | let _unused = lock.lock().unwrap();
help: consider immediately dropping the value
426 | drop(lock.lock().unwrap());
| ~~~~~ +
and am wondering if there is any way to get this kind of error for my own guard types?
That ticket is for clippy, but the lint I'm talking about is in rustc. I was hoping that when the lint was implemented in rustc something more general was used (like in that issue). Or that perhaps there was a workaround I could use.