mem::forget
or mem::drop
on a non-Drop type RS-E1021Calling std::mem::forget
(or std::mem::drop
) on
types that do not implement the Drop trait is a no-op.
Consider revisiting this function call.
struct T {}
fn foo() {
let x = T {};
// Both function calls below are no-ops
// as T does not implement Drop
std::mem::forget(x);
std::mem::drop(x);
}