rust-lang / rust-lang/rust-clippy

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

Open
#8,859 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-an-interesting-project C-enhancement
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

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:

https://github.com/rust-lang/rust-clippy/blob/a98e7ab8b94485be6bd03e0c6b8682ecab5b52e6/clippy_lints/src/let_underscore.rs#L108-L114

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in clippy_lints/src/let_underscore.rs around the hardcoded type-path list and trace how the clippy::has_significant_drop attribute is handled by the related significant_drop_in_scrutinee lint. Replace the primary hardcoded check with attribute detection while retaining the parking_lot path fallback described in the issue, then verify both detection paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.