ptr::null()
RS-C1014Comparisons between ptr::null()
and pointer (*T
) are considered non-idiomatic.
The inbuilt is_null()
method on pointer(*T
) types is equivalent to explicitly comparing against ptr::null()
.
Consider replacing the comparison with is_null()
.
fn foo() {
let x = Some(1);
if x != ptr::null() {
// ...
}
}
fn foo {
let x = Some(1);
if !x.is_null() {
// ...
}
}