rust-lang / rust-lang/rust-clippy
restriction lint: implicit drop
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
detect all locations where drop is called implicitly and suggest turning it into an explicit drop.
possibly has a setting to only warn about locations where a needs_drop value is dropped.
Advantage
would be handy as a learning and debugging tool, allowing you to essentially desugar your code.
Drawbacks
non-trivial implementation for a lint that will never be used in production code.
Example
fn main() {
let s = "Hello, World".to_string();
println!("{s}");
}
Could be written as:
fn main() {
let s = "Hello, World".to_string();
println!("{s}");
drop(s);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name files, tests, or an entry point. Start by locating Clippy's lint registration and existing lints related to ownership or drops, then compare their handling with the example. Done means implicit drops are detected and an explicit drop suggestion is produced, with an optional needs_drop restriction if that scope is accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100