Skip to content

Use unsafe_unwrap (or stdlib equivalent) for NonNull #149

Open
@joshlf

Description

@joshlf

Now that we're using NonNull instead of *mut, we're sometimes using Option<NonNull<T>> where we would otherwise use a *mut T that could be null. Where we previously would have dereferenced if we already knew that the pointer was non-null, we now have to do ptr.unwrap(), which incurs runtime overhead.

Instead, we should use unsafe_unwrap or a stdlib equivalent if one is ever added (see rust-lang/rust#48278).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions