Amanieu / parking_lot

Compact and efficient synchronization primitives for Rust. Also provides an API for creating custom synchronization primitives.
Apache License 2.0
2.77k stars 217 forks source link

Mark `MutexGuard` with `#[clippy::has_significant_drop]` #369

Closed c410-f3r closed 1 year ago

c410-f3r commented 1 year ago

#[clippy::has_significant_drop] tells that a structure should be considered when evaluating some lints. Examples of such behavior are the existent clippy::significant_drop_in_scrutinee and the soon-to-be-finished https://github.com/rust-lang/rust-clippy/issues/9399.

mkroening commented 1 year ago

@c410-f3r, should we also apply this to all the other guards, like the RwLock guards and the reentrant mutex guard, as well as their mapped variants?

c410-f3r commented 1 year ago

Yes, any lock primitive should apply #[clippy::has_significant_drop] in order to trigger the two mentioned lints.

Moreover, it is very likely that other lints will also use #[clippy::has_significant_drop] in the future.

mkroening commented 1 year ago

I opened https://github.com/Amanieu/parking_lot/pull/371.

c410-f3r commented 1 year ago

Nice! Thank you