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

New lint: empty drop #8352

Closed
PyroTechniac opened this issue Jan 26, 2022 · 0 comments · Fixed by #8571
Closed

New lint: empty drop #8352

PyroTechniac opened this issue Jan 26, 2022 · 0 comments · Fixed by #8571
Labels
A-lint Area: New lints

Comments

@PyroTechniac
Copy link
Contributor

What it does

Warns the user on a Drop impl that does nothing

Lint Name

empty_drop

Category

correctness

Advantage

  • Empty drops do nothing, as the value recursively drops the remaining values after running the Drop impl

Drawbacks

None

Example

struct Foo;

impl Drop for Foo {
    fn drop(&mut self) {}
}

Could be written as:

struct Foo;
@PyroTechniac PyroTechniac added the A-lint Area: New lints label Jan 26, 2022
bors added a commit that referenced this issue Apr 21, 2022
add `empty_drop`

Closes #8352

changelog: New lint [`empty_drop`]
@bors bors closed this as completed in a9d31e7 Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant