RS.CLIPPY.ZERO_PTR

Using `0 as *{const, mut} T`

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: zero_ptr. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Catch casts from 0 to some pointer type

Why is this bad?

This generally means null and is better expressed as {std, core}::ptr::{null, null_mut}.

Example

let a = 0 as *const u32;

Use instead:

let a = std::ptr::null::<u32>();