From 32cf2b9e6c174539a640d455ca9b32e47c5baec8 Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Thu, 10 Feb 2022 14:31:19 -0500 Subject: [PATCH] clippy stop yelling at me --- imgui-examples/examples/support/mod.rs | 4 ++-- imgui/src/internal.rs | 8 ++++++++ imgui/src/tables.rs | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/imgui-examples/examples/support/mod.rs b/imgui-examples/examples/support/mod.rs index af26bc2..44e8825 100644 --- a/imgui-examples/examples/support/mod.rs +++ b/imgui-examples/examples/support/mod.rs @@ -137,10 +137,10 @@ impl System { gl_window.window().request_redraw(); } Event::RedrawRequested(_) => { - let mut ui = imgui.frame(); + let ui = imgui.frame(); let mut run = true; - run_ui(&mut run, &mut ui); + run_ui(&mut run, ui); if !run { *control_flow = ControlFlow::Exit; } diff --git a/imgui/src/internal.rs b/imgui/src/internal.rs index a34613e..0af90a1 100644 --- a/imgui/src/internal.rs +++ b/imgui/src/internal.rs @@ -65,6 +65,11 @@ pub trait RawWrapper { } /// Casting from/to a raw type that has the same layout and alignment as the target type +/// +/// # Safety +/// +/// Each function outlines its own safety contract, which generally is +/// that the cast from `T` to `Self` is valid. pub unsafe trait RawCast: Sized { /// Casts an immutable reference from the raw type /// @@ -124,6 +129,9 @@ pub enum DataType { /// /// If this trait is implemented for a type, it is assumed to have *exactly* the same /// representation in memory as the primitive value described by the associated `KIND` constant. +/// +/// # Safety +/// The `DataType` *must* have the same representation as the primitive value of `KIND`. pub unsafe trait DataTypeKind: Copy { const KIND: DataType; } diff --git a/imgui/src/tables.rs b/imgui/src/tables.rs index a49cc5e..5d9b490 100644 --- a/imgui/src/tables.rs +++ b/imgui/src/tables.rs @@ -840,7 +840,7 @@ pub struct Specs<'a>(&'a [sys::ImGuiTableColumnSortSpecs]); impl<'a> Specs<'a> { pub fn iter(self) -> impl Iterator> { - self.0.iter().map(|v| TableColumnSortSpecs(v)) + self.0.iter().map(TableColumnSortSpecs) } }