From 9f7a58b2fd41c7c26d9a21f3f6196fcf19db23b5 Mon Sep 17 00:00:00 2001 From: Arlie Davis Date: Wed, 15 May 2024 12:31:12 -0700 Subject: [PATCH] minor cleanup --- crates/libs/core/src/com_object.rs | 2 +- crates/libs/core/src/interface.rs | 3 +-- crates/libs/implement/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/libs/core/src/com_object.rs b/crates/libs/core/src/com_object.rs index 3f9d2e4f8b..e6c878c37e 100644 --- a/crates/libs/core/src/com_object.rs +++ b/crates/libs/core/src/com_object.rs @@ -11,7 +11,7 @@ use std::borrow::Borrow; /// /// This trait is an implementation detail of the Windows crates. /// User code should not deal directly with this trait. -pub unsafe trait ComImpl { +pub trait ComImpl { /// The generated `_Impl` type (aka the "boxed" type or "outer" type). type Outer: IUnknownImpl; } diff --git a/crates/libs/core/src/interface.rs b/crates/libs/core/src/interface.rs index e9758c47fd..b7acfa7ce7 100644 --- a/crates/libs/core/src/interface.rs +++ b/crates/libs/core/src/interface.rs @@ -190,8 +190,7 @@ impl<'a, I: Interface> InterfaceRef<'a, I> { /// Calls AddRef on the underlying COM interface and returns an "owned" (counted) reference. #[inline(always)] pub fn to_owned(self) -> I { - let interface: &I = &*self; - interface.clone() + (*self).clone() } } diff --git a/crates/libs/implement/src/lib.rs b/crates/libs/implement/src/lib.rs index ba990085a2..a20cd9d9f8 100644 --- a/crates/libs/implement/src/lib.rs +++ b/crates/libs/implement/src/lib.rs @@ -149,7 +149,7 @@ pub fn implement(attributes: proc_macro::TokenStream, original_type: proc_macro: } } - unsafe impl #generics ::windows_core::imp::ComImpl for #original_ident::#generics where #constraints { + impl #generics ::windows_core::imp::ComImpl for #original_ident::#generics where #constraints { type Outer = #impl_ident::#generics; }