44
55use super :: raw:: { AsRawHandle , FromRawHandle , IntoRawHandle , RawHandle } ;
66use crate :: convert:: TryFrom ;
7- use crate :: ffi:: c_void;
87use crate :: fmt;
98use crate :: fs;
109use crate :: marker:: PhantomData ;
@@ -133,7 +132,7 @@ impl TryFrom<HandleOrNull> for OwnedHandle {
133132 #[ inline]
134133 fn try_from ( handle_or_null : HandleOrNull ) -> Result < Self , ( ) > {
135134 let owned_handle = handle_or_null. 0 ;
136- if owned_handle. handle . as_ptr ( ) . is_null ( ) { Err ( ( ) ) } else { Ok ( owned_handle) }
135+ if owned_handle. handle . is_null ( ) { Err ( ( ) ) } else { Ok ( owned_handle) }
137136 }
138137}
139138
@@ -143,32 +142,28 @@ impl TryFrom<HandleOrInvalid> for OwnedHandle {
143142 #[ inline]
144143 fn try_from ( handle_or_invalid : HandleOrInvalid ) -> Result < Self , ( ) > {
145144 let owned_handle = handle_or_invalid. 0 ;
146- if owned_handle. handle . as_ptr ( ) == c:: INVALID_HANDLE_VALUE {
147- Err ( ( ) )
148- } else {
149- Ok ( owned_handle)
150- }
145+ if owned_handle. handle == c:: INVALID_HANDLE_VALUE { Err ( ( ) ) } else { Ok ( owned_handle) }
151146 }
152147}
153148
154149impl AsRawHandle for BorrowedHandle < ' _ > {
155150 #[ inline]
156151 fn as_raw_handle ( & self ) -> RawHandle {
157- self . handle . as_ptr ( )
152+ self . handle
158153 }
159154}
160155
161156impl AsRawHandle for OwnedHandle {
162157 #[ inline]
163158 fn as_raw_handle ( & self ) -> RawHandle {
164- self . handle . as_ptr ( )
159+ self . handle
165160 }
166161}
167162
168163impl IntoRawHandle for OwnedHandle {
169164 #[ inline]
170165 fn into_raw_handle ( self ) -> RawHandle {
171- let handle = self . handle . as_ptr ( ) ;
166+ let handle = self . handle ;
172167 forget ( self ) ;
173168 handle
174169 }
@@ -244,7 +239,7 @@ impl Drop for OwnedHandle {
244239 #[ inline]
245240 fn drop ( & mut self ) {
246241 unsafe {
247- let _ = c:: CloseHandle ( self . handle . as_ptr ( ) ) ;
242+ let _ = c:: CloseHandle ( self . handle ) ;
248243 }
249244 }
250245}
0 commit comments