stop doing option transmuting bruh

This commit is contained in:
2025-09-25 00:39:22 -04:00
parent 51f9908103
commit 4deeabe611

View File

@@ -37,7 +37,10 @@ impl Widgets {
pub fn get_dyn_dynamic(&self, id: &Id) -> WidgetWrapper<'_> { pub fn get_dyn_dynamic(&self, id: &Id) -> WidgetWrapper<'_> {
// SAFETY: must guarantee no other mutable references to this widget exist // SAFETY: must guarantee no other mutable references to this widget exist
// done through the borrow variable // done through the borrow variable
let data: &mut WidgetData = unsafe { std::mem::transmute(self.map.get(id)) }; #[allow(mutable_transmutes)]
let data = unsafe {
std::mem::transmute::<&WidgetData, &mut WidgetData>(self.map.get(id).unwrap())
};
if data.borrowed { if data.borrowed {
panic!("tried to mutably borrow the same widget twice"); panic!("tried to mutably borrow the same widget twice");
} }