Skip to content

Commit

Permalink
codegen: Fully quality std::mem::transmute
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Aug 16, 2023
1 parent a95fb8a commit 8fe7aa3
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion src/analysis/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/analysis/signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/codegen/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ impl FromGlib<{sys_crate_name}::{ffi_name}> for {name} {{
.collect::<Vec<_>>()
.join(", ");
writeln!(w, "debug_assert!([{all_members}].contains(&value));")?;
writeln!(w, "std::mem::transmute(value)",)?;
} else {
writeln!(w, "match value {{")?;
for member in &members {
Expand Down
2 changes: 1 addition & 1 deletion src/writer/to_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 8fe7aa3

Please sign in to comment.