diff --git a/src/input_widget.rs b/src/input_widget.rs index 401630d..fdee459 100644 --- a/src/input_widget.rs +++ b/src/input_widget.rs @@ -151,7 +151,7 @@ extern "C" fn resize_callback(data: *mut sys::ImGuiInputTextCallbackData) -> c_i } } } - return 0; + 0 } } diff --git a/src/lib.rs b/src/lib.rs index 4003250..6f031f2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -109,7 +109,7 @@ pub struct Ui<'ui> { font_atlas: Option>, } -static FMT: &'static [u8] = b"%s\0"; +static FMT: &[u8] = b"%s\0"; fn fmt_ptr() -> *const c_char { FMT.as_ptr() as *const c_char @@ -240,7 +240,7 @@ impl<'ui> Ui<'ui> { buf: &'p mut ImString, size: [f32; 2], ) -> InputTextMultiline<'ui, 'p> { - InputTextMultiline::new(self, label, buf, size.into()) + InputTextMultiline::new(self, label, buf, size) } #[must_use] pub fn input_float<'p>(&self, label: &'p ImStr, value: &'p mut f32) -> InputFloat<'ui, 'p> { @@ -382,8 +382,6 @@ impl<'ui> Ui<'ui> { /// }); /// } /// } - /// # fn main() { - /// # } /// ``` pub fn tooltip(&self, f: F) { unsafe { sys::igBeginTooltip() }; @@ -404,8 +402,6 @@ impl<'ui> Ui<'ui> { /// ui.tooltip_text("I'm a tooltip!"); /// } /// } - /// # fn main() { - /// # } /// ``` pub fn tooltip_text>(&self, text: T) { self.tooltip(|| self.text(text)); @@ -465,10 +461,8 @@ impl<'ui> Ui<'ui> { items: &'p [&'p StringType], height_in_items: i32, ) -> bool { - let items_inner: Vec<*const c_char> = items - .into_iter() - .map(|item| item.as_ref().as_ptr()) - .collect(); + let items_inner: Vec<*const c_char> = + items.iter().map(|item| item.as_ref().as_ptr()).collect(); unsafe { sys::igListBoxStr_arr( label.as_ptr(), diff --git a/src/string.rs b/src/string.rs index d808f92..803f539 100644 --- a/src/string.rs +++ b/src/string.rs @@ -190,7 +190,7 @@ pub struct ImStr(CStr); impl<'a> Default for &'a ImStr { fn default() -> &'a ImStr { - static SLICE: &'static [u8] = &[0]; + static SLICE: &[u8] = &[0]; unsafe { ImStr::from_utf8_with_nul_unchecked(SLICE) } } } diff --git a/src/widget/text.rs b/src/widget/text.rs index 74a15d8..fd0b9d8 100644 --- a/src/widget/text.rs +++ b/src/widget/text.rs @@ -4,7 +4,7 @@ use crate::string::ImStr; use crate::style::StyleColor; use crate::Ui; -static FMT: &'static [u8] = b"%s\0"; +static FMT: &[u8] = b"%s\0"; #[inline] fn fmt_ptr() -> *const c_char {