Skip to content

Commit

Permalink
Simpler "retval" heuristic (#3271)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Sep 12, 2024
1 parent cc08c6c commit dd37c55
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 54 deletions.
11 changes: 1 addition & 10 deletions crates/libs/bindgen/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,7 @@ impl SignatureParam {
if self.ty.deref().size() > 16 {
return false;
}
// Win32 callbacks are defined as `Option<T>` so we don't include them here to avoid
// producing the `Result<Option<T>>` anti-pattern.
match self.ty.deref() {
Type::TypeDef(def, _) => !type_def_is_callback(def),
_ => true,
}
true
}
}

Expand Down Expand Up @@ -491,10 +486,6 @@ fn type_is_trivially_convertible(ty: &Type) -> bool {
}
}

fn type_def_is_callback(row: TypeDef) -> bool {
!row.flags().contains(TypeAttributes::WindowsRuntime) && row.kind() == TypeKind::Delegate
}

pub fn type_def_has_float(def: TypeDef) -> bool {
def.kind() == TypeKind::Struct
&& def
Expand Down
Loading

0 comments on commit dd37c55

Please sign in to comment.