Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename {NonZero,Shared,Unique}::new_checked to new
  • Loading branch information
SimonSapin committed Jul 22, 2017
1 parent 0a08ad0 commit ddaf9b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libcore/nonzero.rs
Expand Up @@ -75,7 +75,7 @@ impl<T: Zeroable> NonZero<T> {

/// Creates an instance of NonZero with the provided value.
#[inline]
pub fn new_checked(inner: T) -> Option<Self> {
pub fn new(inner: T) -> Option<Self> {
if inner.is_zero() {
None
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/ptr.rs
Expand Up @@ -1115,8 +1115,8 @@ impl<T: ?Sized> Unique<T> {
}

/// Creates a new `Unique` if `ptr` is non-null.
pub fn new_checked(ptr: *mut T) -> Option<Self> {
NonZero::new_checked(ptr as *const T).map(|nz| Unique { pointer: nz, _marker: PhantomData })
pub fn new(ptr: *mut T) -> Option<Self> {
NonZero::new(ptr as *const T).map(|nz| Unique { pointer: nz, _marker: PhantomData })
}

/// Acquires the underlying `*mut` pointer.
Expand Down Expand Up @@ -1234,8 +1234,8 @@ impl<T: ?Sized> Shared<T> {
}

/// Creates a new `Shared` if `ptr` is non-null.
pub fn new_checked(ptr: *mut T) -> Option<Self> {
NonZero::new_checked(ptr as *const T).map(|nz| Shared { pointer: nz, _marker: PhantomData })
pub fn new(ptr: *mut T) -> Option<Self> {
NonZero::new(ptr as *const T).map(|nz| Shared { pointer: nz, _marker: PhantomData })
}

/// Acquires the underlying `*mut` pointer.
Expand Down

0 comments on commit ddaf9b2

Please sign in to comment.