NaN
RS-E1012Comparing a floating point with NaN
using ==
or !=
is redundant. NaN
cannot be compared to anything, not even itself. Use .is_nan()
instead.
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.
default()
outside Default
trait RS-E1022Implementing the default()
method outside of the Default
trait is non-idiomatic.
It also makes deriving Default
on any subsequent types using this type impossible,
despite the presence of an implementation for default()
.
mem::forget
or mem::drop
on a reference RS-E1010Calling std::mem::forget
(or std::mem::drop
) on a reference will forget (or
drop) the reference itself, which effectively does nothing. The underlying
reference value will remain unaffected.
mem::forget
or mem::drop
on a Copy type RS-E1011For types that implement the Copy
trait, std::mem::forget
(or
std::mem::drop
) effectively does nothing because the type is copied into the
function call, and the newly copied type is forgotten (or dropped).
Additionally, Copy
types do not have destructors; there is nothing for
std::mem::forget
or (or std::mem::drop
) to do.