Skip to content

Enable the ptr-as-ptr and as-ptr-cast-mut Clippy lints#1384

Merged
d-e-s-o merged 1 commit intolibbpf:masterfrom
d-e-s-o:topic/ptr-lints
Apr 21, 2026
Merged

Enable the ptr-as-ptr and as-ptr-cast-mut Clippy lints#1384
d-e-s-o merged 1 commit intolibbpf:masterfrom
d-e-s-o:topic/ptr-lints

Conversation

@d-e-s-o
Copy link
Copy Markdown
Collaborator

@d-e-s-o d-e-s-o commented Apr 21, 2026

Replace as *const _ / as *mut _ pointer casts with the more type-safe .cast(), .cast::<T>(), and .cast_mut() methods throughout the codebase. Where applicable, also use &raw const / &raw mut instead of taking a reference and casting it.

Enable the ptr-as-ptr and as-ptr-cast-mut Clippy lints as warnings to prevent regressions.

Replace `as *const _` / `as *mut _` pointer casts with the more
type-safe `.cast()`, `.cast::<T>()`, and `.cast_mut()` methods
throughout the codebase. Where applicable, also use `&raw const` /
`&raw mut` instead of taking a reference and casting it.

Enable the `ptr-as-ptr` and `as-ptr-cast-mut` Clippy lints as warnings
to prevent regressions.

Signed-off-by: Daniel Müller <deso@posteo.net>
@d-e-s-o d-e-s-o enabled auto-merge (rebase) April 21, 2026 18:16
@d-e-s-o d-e-s-o merged commit ecaf2db into libbpf:master Apr 21, 2026
18 checks passed
@d-e-s-o d-e-s-o deleted the topic/ptr-lints branch April 21, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant