]>
Commit | Line | Data |
---|---|---|
f2b60f7d FG |
1 | ### What it does |
2 | Checks for calls to `std::mem::drop` with a value | |
3 | that derives the Copy trait | |
4 | ||
5 | ### Why is this bad? | |
6 | Calling `std::mem::drop` [does nothing for types that | |
7 | implement Copy](https://doc.rust-lang.org/std/mem/fn.drop.html), since the | |
8 | value will be copied and moved into the function on invocation. | |
9 | ||
10 | ### Example | |
11 | ``` | |
12 | let x: i32 = 42; // i32 implements Copy | |
13 | std::mem::drop(x) // A copy of x is passed to the function, leaving the | |
14 | // original unaffected | |
15 | ``` |