]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/forget_ref.txt
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
[rust.git] / src / tools / clippy / src / docs / forget_ref.txt
1 ### What it does
2 Checks for calls to `std::mem::forget` with a reference
3 instead of an owned value.
4
5 ### Why is this bad?
6 Calling `forget` on a reference will only forget the
7 reference itself, which is a no-op. It will not forget the underlying
8 referenced
9 value, which is likely what was intended.
10
11 ### Example
12 ```
13 let x = Box::new(1);
14 std::mem::forget(&x) // Should have been forget(x), x will still be dropped
15 ```