diff --git a/crates/tests/component/src/bindings.rs b/crates/tests/component/src/bindings.rs index 907164a08b..4ba48a1b39 100644 --- a/crates/tests/component/src/bindings.rs +++ b/crates/tests/component/src/bindings.rs @@ -73,8 +73,8 @@ pub mod Nested { Method: Method::, } } - pub fn matches(iid: &::windows_core::GUID) -> bool { - iid == &::IID + pub unsafe fn matches(iid: *const ::windows_core::GUID) -> bool { + *iid == ::IID } } } @@ -382,13 +382,13 @@ impl ::windows_core::Result + ::core::marker::Send + 'stat }; unsafe extern "system" fn QueryInterface( this: *mut ::core::ffi::c_void, - iid: &::windows_core::GUID, - interface: *mut *const ::core::ffi::c_void, + iid: *const ::windows_core::GUID, + interface: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; - *interface = if iid == &::IID - || iid == &<::windows_core::IUnknown as ::windows_core::ComInterface>::IID - || iid == &<::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID + *interface = if *iid == ::IID + || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID + || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { @@ -643,7 +643,7 @@ impl IClass_Vtbl { Input: Input::, } } - pub fn matches(iid: &::windows_core::GUID) -> bool { - iid == &::IID + pub unsafe fn matches(iid: *const ::windows_core::GUID) -> bool { + *iid == ::IID } } diff --git a/crates/tests/component_client/src/bindings.rs b/crates/tests/component_client/src/bindings.rs index 20a62245b1..ba52fcd11e 100644 --- a/crates/tests/component_client/src/bindings.rs +++ b/crates/tests/component_client/src/bindings.rs @@ -350,13 +350,13 @@ impl ::windows_core::Result + ::core::marker::Send + 'stat }; unsafe extern "system" fn QueryInterface( this: *mut ::core::ffi::c_void, - iid: &::windows_core::GUID, - interface: *mut *const ::core::ffi::c_void, + iid: *const ::windows_core::GUID, + interface: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT { let this = this as *mut *mut ::core::ffi::c_void as *mut Self; - *interface = if iid == &::IID - || iid == &<::windows_core::IUnknown as ::windows_core::ComInterface>::IID - || iid == &<::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID + *interface = if *iid == ::IID + || *iid == <::windows_core::IUnknown as ::windows_core::ComInterface>::IID + || *iid == <::windows_core::imp::IAgileObject as ::windows_core::ComInterface>::IID { &mut (*this).vtable as *mut _ as _ } else { diff --git a/crates/tests/implement/tests/class_factory.rs b/crates/tests/implement/tests/class_factory.rs index bd510d853f..ff53dd1125 100644 --- a/crates/tests/implement/tests/class_factory.rs +++ b/crates/tests/implement/tests/class_factory.rs @@ -32,7 +32,7 @@ impl IClassFactory_Impl for Factory { ) -> Result<()> { assert!(outer.is_none()); let unknown: IInspectable = Object().into(); - unsafe { unknown.query(&*iid, object as *mut _).ok() } + unsafe { unknown.query(iid, object).ok() } } fn LockServer(&self, lock: BOOL) -> Result<()> { diff --git a/crates/tests/implement/tests/from_raw_borrowed.rs b/crates/tests/implement/tests/from_raw_borrowed.rs index fc34529522..61d9cf6d9d 100644 --- a/crates/tests/implement/tests/from_raw_borrowed.rs +++ b/crates/tests/implement/tests/from_raw_borrowed.rs @@ -25,7 +25,7 @@ impl IServiceProvider_Impl for Borrowed { ) -> Result<()> { unsafe { let unknown: IUnknown = self.cast()?; - unknown.query(&*iid, object as _).ok() + unknown.query(iid, object).ok() } } } diff --git a/crates/tests/weak_ref/tests/count.rs b/crates/tests/weak_ref/tests/count.rs index cbe873b89e..d89ad20011 100644 --- a/crates/tests/weak_ref/tests/count.rs +++ b/crates/tests/weak_ref/tests/count.rs @@ -6,10 +6,10 @@ use windows::Win32::System::WinRT::IWeakReferenceSource; fn test() { // Ref count starts at 1 let count = WeakRefCount::new(); - assert!(count.add_ref() == 2); - assert!(count.add_ref() == 3); - assert!(count.release() == 2); - assert!(count.release() == 1); + assert_eq!(count.add_ref(), 2); + assert_eq!(count.add_ref(), 3); + assert_eq!(count.release(), 2); + assert_eq!(count.release(), 1); // Query implies add_ref unsafe { @@ -17,8 +17,8 @@ fn test() { } // Ref count is now owned by tearoff - assert!(count.add_ref() == 3); - assert!(count.release() == 2); - assert!(count.release() == 1); - assert!(count.release() == 0); + assert_eq!(count.add_ref(), 3); + assert_eq!(count.release(), 2); + assert_eq!(count.release(), 1); + assert_eq!(count.release(), 0); }