RS.CLIPPY.POINTER_FORMAT

Formatting a pointer

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

What it does

Detects pointer format as well as Debug formatting of raw pointers or function pointers or any types that have a derived Debug impl that recursively contains them.

Why restrict this?

The addresses are only useful in very specific contexts, and certain projects may want to keep addresses of certain data structures or functions from prying hacker eyes as an additional line of security.

Known problems

The lint currently only looks through derived Debug implementations. Checking whether a manual implementation prints an address is left as an exercise to the next lint implementer.

Example

let foo = &0_u32;
fn bar() {}
println!("{:p}", foo);
let _ = format!("{:?}", &(bar as fn()));