Fix a couple missed clippy issues

This commit is contained in:
Thom Chiovoloni 2020-12-05 22:43:49 -08:00
parent 3a1aa3a684
commit fde0336af2
3 changed files with 4 additions and 3 deletions

View File

@ -100,7 +100,7 @@ fn test_imvec2_memory_layout() {
assert_eq!(mem::align_of::<ImVec2>(), 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::<ImVec4>(), 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 _);

View File

@ -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();
}

View File

@ -1,3 +1,4 @@
#![allow(clippy::float_cmp)]
pub extern crate imgui_sys as sys;
use std::cell;