From 8fe7aa3cd482312f320967433f31075356c0d725 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Wed, 16 Aug 2023 11:46:17 +0200 Subject: [PATCH] codegen: Fully quality std::mem::transmute --- src/analysis/properties.rs | 1 - src/analysis/signals.rs | 1 - src/codegen/enums.rs | 1 - src/writer/to_code.rs | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/analysis/properties.rs b/src/analysis/properties.rs index 83e5b854f..20b1b5719 100644 --- a/src/analysis/properties.rs +++ b/src/analysis/properties.rs @@ -343,7 +343,6 @@ fn analyze_property( imports.add("glib::prelude::*"); } imports.add("glib::signal::{connect_raw, SignalHandlerId}"); - imports.add("std::mem::transmute"); imports.add("std::boxed::Box as Box_"); Some(signals::Info { diff --git a/src/analysis/signals.rs b/src/analysis/signals.rs index 1c30032e4..cb147d413 100644 --- a/src/analysis/signals.rs +++ b/src/analysis/signals.rs @@ -103,7 +103,6 @@ fn analyze_signal( imports.add_used_types(&used_types); imports.add("glib::prelude::*"); imports.add("glib::signal::{connect_raw, SignalHandlerId}"); - imports.add("std::mem::transmute"); imports.add("std::boxed::Box as Box_"); } let generate_doc = configured_signals.iter().all(|f| f.generate_doc); diff --git a/src/codegen/enums.rs b/src/codegen/enums.rs index c3722d147..2da9e16b6 100644 --- a/src/codegen/enums.rs +++ b/src/codegen/enums.rs @@ -313,7 +313,6 @@ impl FromGlib<{sys_crate_name}::{ffi_name}> for {name} {{ .collect::>() .join(", "); writeln!(w, "debug_assert!([{all_members}].contains(&value));")?; - writeln!(w, "std::mem::transmute(value)",)?; } else { writeln!(w, "match value {{")?; for member in &members { diff --git a/src/writer/to_code.rs b/src/writer/to_code.rs index e9a3cae91..c908bb094 100644 --- a/src/writer/to_code.rs +++ b/src/writer/to_code.rs @@ -163,7 +163,7 @@ impl ToCode for Chunk { } let self_str = if in_trait { "Self, " } else { "" }; v.push(format!( - "\tSome(transmute::<_, unsafe extern \"C\" fn()>({trampoline}::<{self_str}F> as *const ())), Box_::into_raw(f))" + "\tSome(std::mem::transmute::<_, unsafe extern \"C\" fn()>({trampoline}::<{self_str}F> as *const ())), Box_::into_raw(f))" )); v }