DROPPING_COPY_TYPES in rustc_lint::drop_forget_useless - Rust
Description: The `dropping_copy_types` lint checks for calls to `std::mem::drop` with a value that derives the Copy trait.

Skip to main content

## DROPPING_COPY_TYPES

# Static DROPPING_COPY_TYPES

Source

    pub static DROPPING_COPY_TYPES: &Lint

Expand description

The `dropping_copy_types` lint checks for calls to `std::mem::drop` with a value that derives the Copy trait.

#### §Example

    let x: i32 = 42; // i32 implements Copy
    std::mem::drop(x); // A copy of x is passed to the function, leaving the
                       // original unaffected

{{produces}}

#### §Explanation

Calling `std::mem::drop` does nothing for types that implement Copy, since the value will be copied and moved into the function on invocation.