Skip to content
Myr

Resolve nonnull_unchecked_on_box_ptr clippy lint

Before adoption: this commit came in with the history the project adopted, so no landing records it.

warning: use of `NonNull::new_unchecked` with `Box::into_raw` --> src/ptr.rs:34:18 | 34 | ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `NonNull::from(Box::leak(ptr))` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonnull_unchecked_on_box_ptr = note: `-W clippy::nonnull-unchecked-on-box-ptr` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::nonnull_unchecked_on_box_ptr)]`

authored by David Tolnay · committed by David Tolnay · parent 30e1a6f · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:src/ptr.rs+1 added-1 removed
29 unmodified lines
30 T: ?Sized,31{32 pub fn new(ptr: Box<T>) -> Self {33 Own {34 ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },34 ptr: NonNull::from(Box::leak(ptr)),35 }36 }3738 pub fn cast<U: CastTo>(self) -> Own<U::Target> {
149 unmodified lines