diff --git a/imgui-sys/src/lib.rs b/imgui-sys/src/lib.rs index d2e7a40..af8addf 100644 --- a/imgui-sys/src/lib.rs +++ b/imgui-sys/src/lib.rs @@ -100,7 +100,7 @@ fn test_imvec2_memory_layout() { assert_eq!(mem::align_of::(), mem::align_of::<[f32; 2]>()); let test = ImVec2::new(1.0, 2.0); let ref_a: &ImVec2 = &test; - let ref_b: &[f32; 2] = unsafe { mem::transmute(&test) }; + let ref_b: &[f32; 2] = unsafe { &*(&test as *const _ as *const [f32; 2]) }; assert_eq!(&ref_a.x as *const _, &ref_b[0] as *const _); assert_eq!(&ref_a.y as *const _, &ref_b[1] as *const _); } @@ -112,7 +112,7 @@ fn test_imvec4_memory_layout() { assert_eq!(mem::align_of::(), mem::align_of::<[f32; 4]>()); let test = ImVec4::new(1.0, 2.0, 3.0, 4.0); let ref_a: &ImVec4 = &test; - let ref_b: &[f32; 4] = unsafe { mem::transmute(&test) }; + let ref_b: &[f32; 4] = unsafe { &*(&test as *const _ as *const [f32; 4]) }; assert_eq!(&ref_a.x as *const _, &ref_b[0] as *const _); assert_eq!(&ref_a.y as *const _, &ref_b[1] as *const _); assert_eq!(&ref_a.z as *const _, &ref_b[2] as *const _); diff --git a/src/context.rs b/src/context.rs index 66029ea..880f04c 100644 --- a/src/context.rs +++ b/src/context.rs @@ -388,7 +388,7 @@ fn test_shared_font_atlas() { let _guard = crate::test::TEST_MUTEX.lock(); let atlas = Rc::new(RefCell::new(SharedFontAtlas::create())); let suspended1 = SuspendedContext::create_with_shared_font_atlas(atlas.clone()); - let mut ctx2 = Context::create_with_shared_font_atlas(atlas.clone()); + let mut ctx2 = Context::create_with_shared_font_atlas(atlas); { let _borrow = ctx2.fonts(); } diff --git a/src/lib.rs b/src/lib.rs index bb0ee21..e42cd40 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::float_cmp)] pub extern crate imgui_sys as sys; use std::cell;