Closed
Description
Lint name: let_underscore_lock
I tried this code:
fn main() {
{
use parking_lot::{Mutex, lock_api::RawMutex}; // 0.11.2
let mutex: Mutex<()> = Mutex::const_new(RawMutex::INIT, ());
let _ = mutex.lock();
}
{
use std::sync::Mutex;
let mutex: Mutex<()> = Mutex::new(());
let _ = mutex.lock().unwrap();
}
}
I expected to see this happen:
Since parking_lot
is widely used, and usually always the preferred alternative compared to the std
locks, I expected clippy
to know about it.
Instead, this happened:
clippy
seems to only care about std
locks:
Checking playground v0.0.1 (/playground)
error: non-binding let on a synchronization lock
--> src/main.rs:13:9
|
13 | let _ = mutex.lock().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::let_underscore_lock)]` on by default
= help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_lock
error: could not compile `playground` due to previous error
Meta
rustc 1.57.0-nightly (98c861950 2021-09-27)
binary: rustc
commit-hash: 98c8619502093f34ca82f8f26ccf32e753924440
commit-date: 2021-09-27
host: x86_64-pc-windows-msvc
release: 1.57.0-nightly
LLVM version: 13.0.0