mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-25 04:23:22 +00:00
27 lines
391 B
Rust
27 lines
391 B
Rust
#![warn(clippy::forget_non_drop)]
|
|
|
|
use core::mem::forget;
|
|
|
|
fn forget_generic<T>(t: T) {
|
|
// Don't lint
|
|
forget(t)
|
|
}
|
|
|
|
fn main() {
|
|
struct Foo;
|
|
// Lint
|
|
forget(Foo);
|
|
|
|
struct Bar;
|
|
impl Drop for Bar {
|
|
fn drop(&mut self) {}
|
|
}
|
|
// Don't lint
|
|
forget(Bar);
|
|
|
|
struct Baz<T>(T);
|
|
// Lint
|
|
forget(Baz(Foo));
|
|
// Don't lint
|
|
forget(Baz(Bar));
|
|
}
|