]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/src/docs/drop_copy.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / drop_copy.txt
CommitLineData
f2b60f7d
FG
1### What it does
2Checks for calls to `std::mem::drop` with a value
3that derives the Copy trait
4
5### Why is this bad?
6Calling `std::mem::drop` [does nothing for types that
7implement Copy](https://doc.rust-lang.org/std/mem/fn.drop.html), since the
8value will be copied and moved into the function on invocation.
9
10### Example
11```
12let x: i32 = 42; // i32 implements Copy
13std::mem::drop(x) // A copy of x is passed to the function, leaving the
14 // original unaffected
15```