Rename {NonZero,Shared,Unique}::new_checked to new

This commit is contained in:
Simon Sapin 2017-06-29 01:06:20 +02:00
parent 0a08ad0443
commit ddaf9b24f0
2 changed files with 5 additions and 5 deletions

View File

@ -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 {

View File

@ -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.
@ -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.