Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy::let_underscore_lock lint should use #[clippy::has_significant_drop] attribute rather than a hardcoded list #8859

Open
CAD97 opened this issue May 21, 2022 · 1 comment
Labels
C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@CAD97
Copy link
Contributor

CAD97 commented May 21, 2022

Description

#[clippy::has_significant_drop] was added for the lint clippy::significant_drop_in_scrutinee.

The clippy::let_underscore_lock currently uses a hardcoded list of type paths to lint against:

const SYNC_GUARD_PATHS: [&[&str]; 5] = [
&paths::MUTEX_GUARD,
&paths::RWLOCK_READ_GUARD,
&paths::RWLOCK_WRITE_GUARD,
&paths::PARKING_LOT_RAWMUTEX,
&paths::PARKING_LOT_RAWRWLOCK,
];

Instead, it should use the presence of the new #[clippy::has_significant_drop] attribute.

Checking for the parking_lot types by path might need to stay around for a while until most parking_lot consumers are using a version with the #[clippy::has_significant_drop] attribute.

Version

git master

Additional Labels

@rustbot label +C-enhancement +C-an-interesting-project
(I guess)

@rustbot rustbot added C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages labels May 21, 2022
@CAD97
Copy link
Contributor Author

CAD97 commented May 21, 2022

Another mentioned possible heuristic is a #[must_use] type with an explicit Drop implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

No branches or pull requests

2 participants