Simplify dioxus-config-macro (#2514)

* refactor config macro code

* fix clippy
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-06-18 16:10:23 -07:00
1 parent 3a4860add4
commit b0ae9be9c8
4 files changed
+39 -134

No files matched your search

+4 -1
View File
@@ -95,8 +95,11 @@ impl<O> std::ops::Deref for UseCallback<O> {
// The real closure that we will never use.
&uninit_closure
},
#[allow(clippy::missing_transmute_annotations)]
// We transmute self into a reference to the closure. This is safe because we know that the closure has the same memory layout as Self so &Closure == &Self.
unsafe { std::mem::transmute(self) },
unsafe {
std::mem::transmute(self)
},
);
// Cast the closure to a trait object.