Skip to content

Commit

Permalink
simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Sep 13, 2024
1 parent bb0c38d commit 75ef7ca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
8 changes: 1 addition & 7 deletions crates/libs/bindgen/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,13 +628,7 @@ pub fn type_def_is_blittable(row: TypeDef) -> bool {

pub fn type_def_is_copyable(row: TypeDef) -> bool {
match row.kind() {
TypeKind::Struct => {
if matches!(row.type_name(), TypeName::VARIANT | TypeName::PROPVARIANT) {
false
} else {
row.fields().all(|field| field_is_copyable(field, row))
}
}
TypeKind::Struct => row.fields().all(|field| field_is_copyable(field, row)),
TypeKind::Enum => true,
TypeKind::Delegate => !row.flags().contains(TypeAttributes::WindowsRuntime),
_ => false,
Expand Down
14 changes: 0 additions & 14 deletions crates/libs/bindgen/src/rust/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,6 @@ impl Writer {
let crate_name = self.crate_name();
quote! { #crate_name BSTR }
}
metadata::Type::Name(metadata::TypeName::VARIANT) => {
let crate_name = self.crate_name();
quote! { #crate_name VARIANT }
}
metadata::Type::Name(metadata::TypeName::PROPVARIANT) => {
let crate_name = self.crate_name();
quote! { #crate_name PROPVARIANT }
}
metadata::Type::Object => {
if self.sys {
quote! { *mut core::ffi::c_void }
Expand Down Expand Up @@ -271,12 +263,6 @@ impl Writer {
metadata::Type::Name(metadata::TypeName::BSTR) => {
quote! { core::mem::MaybeUninit<windows_core::BSTR> }
}
metadata::Type::Name(metadata::TypeName::VARIANT) => {
quote! { core::mem::MaybeUninit<windows_core::VARIANT> }
}
metadata::Type::Name(metadata::TypeName::PROPVARIANT) => {
quote! { core::mem::MaybeUninit<windows_core::PROPVARIANT> }
}
metadata::Type::Win32Array(kind, len) => {
let name = self.type_abi_name(kind);
let len = Literal::usize_unsuffixed(*len);
Expand Down

0 comments on commit 75ef7ca

Please sign in to comment.