Skip to content

New lint: empty drop #8352

Closed
Closed
@PyroTechniac

Description

@PyroTechniac

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions