]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/forget_non_drop.rs
Merge commit '0cb0f7636851f9fcc57085cf80197a2ef6db098f' into clippyup
[rust.git] / src / tools / clippy / tests / ui / forget_non_drop.rs
1 #![warn(clippy::forget_non_drop)]
2
3 use core::mem::forget;
4
5 fn forget_generic<T>(t: T) {
6     // Don't lint
7     forget(t)
8 }
9
10 fn main() {
11     struct Foo;
12     // Lint
13     forget(Foo);
14
15     struct Bar;
16     impl Drop for Bar {
17         fn drop(&mut self) {}
18     }
19     // Don't lint
20     forget(Bar);
21
22     struct Baz<T>(T);
23     // Lint
24     forget(Baz(Foo));
25     // Don't lint
26     forget(Baz(Bar));
27 }