File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ impl<T> Carton<T> {
102102 pub fn new (value : T ) -> Self {
103103 // Allocate enough memory on the heap to store one T.
104104 assert_ne! (size_of :: <T >(), 0 , " Zero-sized types are out of the scope of this example" );
105- let mut memptr = ptr :: null_mut () as * mut T ;
105+ let mut memptr : * mut T = ptr :: null_mut ();
106106 unsafe {
107107 let ret = libc :: posix_memalign (
108108 (& mut memptr ). cast (),
@@ -113,10 +113,10 @@ impl<T> Carton<T> {
113113 };
114114
115115 // NonNull is just a wrapper that enforces that the pointer isn't null.
116- let mut ptr = unsafe {
116+ let ptr = {
117117 // Safety: memptr is dereferenceable because we created it from a
118118 // reference and have exclusive access.
119- ptr :: NonNull :: new (memptr . cast :: < T >() )
119+ ptr :: NonNull :: new (memptr )
120120 . expect (" Guaranteed non-null if posix_memalign returns 0" )
121121 };
122122
You can’t perform that action at this time.
0 commit comments