diff --git a/imgui/src/clipboard.rs b/imgui/src/clipboard.rs index 7be4043..09e721e 100644 --- a/imgui/src/clipboard.rs +++ b/imgui/src/clipboard.rs @@ -53,7 +53,7 @@ impl ClipboardBackend for DummyClipboardContext { } impl fmt::Debug for ClipboardContext { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("ClipboardContext") // beautiful code, no? .field("backend", &(&(*self.backend) as *const _)) diff --git a/imgui/src/context.rs b/imgui/src/context.rs index 8139b3c..592ed88 100644 --- a/imgui/src/context.rs +++ b/imgui/src/context.rs @@ -502,7 +502,7 @@ impl Context { /// # Panics /// /// Panics if the context uses a shared font atlas that is already borrowed - pub fn fonts(&mut self) -> FontAtlasRefMut { + pub fn fonts(&mut self) -> FontAtlasRefMut<'_> { match self.shared_font_atlas { Some(ref font_atlas) => FontAtlasRefMut::Shared(font_atlas.borrow_mut()), None => unsafe { @@ -518,7 +518,7 @@ impl Context { /// /// Panics if the context uses a shared font atlas that is already borrowed #[doc(alias = "NewFame")] - pub fn frame(&mut self) -> Ui { + pub fn frame(&mut self) -> Ui<'_> { // Clear default font if it no longer exists. This could be an error in the future let default_font = self.io().font_default; if !default_font.is_null() && self.fonts().get_font(FontId(default_font)).is_none() { diff --git a/imgui/src/draw_list.rs b/imgui/src/draw_list.rs index 296caa0..4ecf07c 100644 --- a/imgui/src/draw_list.rs +++ b/imgui/src/draw_list.rs @@ -174,7 +174,7 @@ impl<'ui> DrawListMut<'ui> { /// } /// ``` #[doc(alias = "ChannelsSplit")] - pub fn channels_split(&self, channels_count: u32, f: F) { + pub fn channels_split)>(&self, channels_count: u32, f: F) { unsafe { sys::ImDrawList_ChannelsSplit(self.draw_list, channels_count as i32) }; f(&ChannelsSplit { draw_list: self, @@ -373,7 +373,7 @@ impl<'ui> DrawListMut<'ui> { /// .build(); /// } /// ``` - pub fn add_image(&'ui self, texture_id: TextureId, p_min: [f32; 2], p_max: [f32; 2]) -> Image { + pub fn add_image(&'ui self, texture_id: TextureId, p_min: [f32; 2], p_max: [f32; 2]) -> Image<'_> { Image::new(self, texture_id, p_min, p_max) } @@ -387,7 +387,7 @@ impl<'ui> DrawListMut<'ui> { p2: [f32; 2], p3: [f32; 2], p4: [f32; 2], - ) -> ImageQuad { + ) -> ImageQuad<'_> { ImageQuad::new(self, texture_id, p1, p2, p3, p4) } @@ -398,7 +398,7 @@ impl<'ui> DrawListMut<'ui> { p_min: [f32; 2], p_max: [f32; 2], rounding: f32, - ) -> ImageRounded { + ) -> ImageRounded<'_> { ImageRounded::new(self, texture_id, p_min, p_max, rounding) } } @@ -414,7 +414,7 @@ pub struct Line<'ui> { } impl<'ui> Line<'ui> { - fn new(draw_list: &'ui DrawListMut, p1: [f32; 2], p2: [f32; 2], c: C) -> Self + fn new(draw_list: &'ui DrawListMut<'_>, p1: [f32; 2], p2: [f32; 2], c: C) -> Self where C: Into, { @@ -461,7 +461,7 @@ pub struct Rect<'ui> { } impl<'ui> Rect<'ui> { - fn new(draw_list: &'ui DrawListMut, p1: [f32; 2], p2: [f32; 2], c: C) -> Self + fn new(draw_list: &'ui DrawListMut<'_>, p1: [f32; 2], p2: [f32; 2], c: C) -> Self where C: Into, { @@ -562,7 +562,7 @@ pub struct Triangle<'ui> { } impl<'ui> Triangle<'ui> { - fn new(draw_list: &'ui DrawListMut, p1: [f32; 2], p2: [f32; 2], p3: [f32; 2], c: C) -> Self + fn new(draw_list: &'ui DrawListMut<'_>, p1: [f32; 2], p2: [f32; 2], p3: [f32; 2], c: C) -> Self where C: Into, { @@ -630,7 +630,7 @@ pub struct Circle<'ui> { impl<'ui> Circle<'ui> { /// Typically constructed by [`DrawListMut::add_circle`] - pub fn new(draw_list: &'ui DrawListMut, center: [f32; 2], radius: f32, color: C) -> Self + pub fn new(draw_list: &'ui DrawListMut<'_>, center: [f32; 2], radius: f32, color: C) -> Self where C: Into, { @@ -708,7 +708,7 @@ pub struct BezierCurve<'ui> { impl<'ui> BezierCurve<'ui> { /// Typically constructed by [`DrawListMut::add_bezier_curve`] pub fn new( - draw_list: &'ui DrawListMut, + draw_list: &'ui DrawListMut<'_>, pos0: [f32; 2], cp0: [f32; 2], cp1: [f32; 2], @@ -776,7 +776,7 @@ pub struct Image<'ui> { impl<'ui> Image<'ui> { /// Typically constructed by [`DrawListMut::add_image`] pub fn new( - draw_list: &'ui DrawListMut, + draw_list: &'ui DrawListMut<'_>, texture_id: TextureId, p_min: [f32; 2], p_max: [f32; 2], @@ -849,7 +849,7 @@ pub struct ImageQuad<'ui> { impl<'ui> ImageQuad<'ui> { /// Typically constructed by [`DrawListMut::add_image_quad`] pub fn new( - draw_list: &'ui DrawListMut, + draw_list: &'ui DrawListMut<'_>, texture_id: TextureId, p1: [f32; 2], p2: [f32; 2], @@ -936,7 +936,7 @@ pub struct ImageRounded<'ui> { impl<'ui> ImageRounded<'ui> { /// Typically constructed by [`DrawListMut::add_image_rounded`] pub fn new( - draw_list: &'ui DrawListMut, + draw_list: &'ui DrawListMut<'_>, texture_id: TextureId, p_min: [f32; 2], p_max: [f32; 2], diff --git a/imgui/src/fonts/atlas.rs b/imgui/src/fonts/atlas.rs index 6f12e56..708b494 100644 --- a/imgui/src/fonts/atlas.rs +++ b/imgui/src/fonts/atlas.rs @@ -70,7 +70,7 @@ unsafe impl RawCast for FontAtlas {} impl FontAtlas { #[doc(alias = "AddFontDefault", alias = "AddFont")] - pub fn add_font(&mut self, font_sources: &[FontSource]) -> FontId { + pub fn add_font(&mut self, font_sources: &[FontSource<'_>]) -> FontId { let (head, tail) = font_sources.split_first().unwrap(); let font_id = self.add_font_internal(head, false); for font in tail { @@ -78,7 +78,7 @@ impl FontAtlas { } font_id } - fn add_font_internal(&mut self, font_source: &FontSource, merge_mode: bool) -> FontId { + fn add_font_internal(&mut self, font_source: &FontSource<'_>, merge_mode: bool) -> FontId { let mut raw_config = sys_font_config_default(); raw_config.MergeMode = merge_mode; let raw_font = match font_source { @@ -141,7 +141,7 @@ impl FontAtlas { } /// Builds a 1 byte per-pixel font atlas texture #[doc(alias = "GetTextDataAsAlpha8")] - pub fn build_alpha8_texture(&mut self) -> FontAtlasTexture { + pub fn build_alpha8_texture(&mut self) -> FontAtlasTexture<'_> { let mut pixels: *mut c_uchar = ptr::null_mut(); let mut width: c_int = 0; let mut height: c_int = 0; @@ -175,7 +175,7 @@ impl FontAtlas { } /// Builds a 4 byte per-pixel font atlas texture #[doc(alias = "GetTextDataAsRGBA32")] - pub fn build_rgba32_texture(&mut self) -> FontAtlasTexture { + pub fn build_rgba32_texture(&mut self) -> FontAtlasTexture<'_> { let mut pixels: *mut c_uchar = ptr::null_mut(); let mut width: c_int = 0; let mut height: c_int = 0; diff --git a/imgui/src/input_widget.rs b/imgui/src/input_widget.rs index 5143683..2658133 100644 --- a/imgui/src/input_widget.rs +++ b/imgui/src/input_widget.rs @@ -859,7 +859,7 @@ extern "C" fn callback( let callback_data = unsafe { CallbackData { event_flag: InputTextFlags::from_bits((*data).EventFlag as u32).unwrap(), - user_data: &mut *((*data).UserData as *mut UserData), + user_data: &mut *((*data).UserData as *mut UserData<'_, T>), } }; diff --git a/imgui/src/layout.rs b/imgui/src/layout.rs index d3d5db5..f039b17 100644 --- a/imgui/src/layout.rs +++ b/imgui/src/layout.rs @@ -101,7 +101,7 @@ impl<'ui> Ui<'ui> { /// /// Returns a `GroupToken` that must be ended by calling `.end()` #[doc(alias = "BeginGroup")] - pub fn begin_group(&self) -> GroupToken { + pub fn begin_group(&self) -> GroupToken<'_> { unsafe { sys::igBeginGroup() }; GroupToken::new(self) } diff --git a/imgui/src/lib.rs b/imgui/src/lib.rs index 333fd2e..7697fa2 100644 --- a/imgui/src/lib.rs +++ b/imgui/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(test, allow(clippy::float_cmp))] +#![deny(rust_2018_idioms)] pub extern crate imgui_sys as sys; use std::cell; @@ -95,18 +96,12 @@ pub fn dear_imgui_version() -> &'static str { } } -#[test] -fn test_version() { - // TODO: what's the point of this test? - assert!(dear_imgui_version().starts_with("1.")); -} - impl Context { /// Returns the global imgui-rs time. /// /// Incremented by Io::delta_time every frame. #[doc(alias = "GetTime")] - pub fn time(&self, input: f64) -> f64 { + pub fn time(&self) -> f64 { unsafe { sys::igGetTime() } } /// Returns the global imgui-rs frame count. @@ -171,8 +166,9 @@ impl<'ui> Ui<'ui> { pub fn io(&self) -> &Io { unsafe { &*(sys::igGetIO() as *const Io) } } + /// Returns an immutable reference to the font atlas - pub fn fonts(&self) -> FontAtlasRef { + pub fn fonts(&self) -> FontAtlasRef<'_> { match self.font_atlas { Some(ref font_atlas) => FontAtlasRef::Shared(font_atlas), None => unsafe { diff --git a/imgui/src/render/draw_data.rs b/imgui/src/render/draw_data.rs index d7b3c2f..0bd3e49 100644 --- a/imgui/src/render/draw_data.rs +++ b/imgui/src/render/draw_data.rs @@ -37,7 +37,7 @@ unsafe impl RawCast for DrawData {} impl DrawData { /// Returns an iterator over the draw lists included in the draw data. #[inline] - pub fn draw_lists(&self) -> DrawListIterator { + pub fn draw_lists(&self) -> DrawListIterator<'_> { unsafe { DrawListIterator { iter: self.cmd_lists().iter(), @@ -181,7 +181,7 @@ impl DrawList { } #[inline] - pub fn commands(&self) -> DrawCmdIterator { + pub fn commands(&self) -> DrawCmdIterator<'_> { unsafe { DrawCmdIterator { iter: self.cmd_buffer().iter(), diff --git a/imgui/src/stacks.rs b/imgui/src/stacks.rs index 11bebe6..37fdced 100644 --- a/imgui/src/stacks.rs +++ b/imgui/src/stacks.rs @@ -59,7 +59,7 @@ impl<'ui> Ui<'ui> { /// color.pop(); /// ``` #[doc(alias = "PushStyleColorVec4")] - pub fn push_style_color(&self, style_color: StyleColor, color: [f32; 4]) -> ColorStackToken { + pub fn push_style_color(&self, style_color: StyleColor, color: [f32; 4]) -> ColorStackToken<'_> { unsafe { sys::igPushStyleColor_Vec4(style_color as i32, color.into()) }; ColorStackToken::new(self) } @@ -115,7 +115,7 @@ impl<'ui> Ui<'ui> { /// style.pop(); /// ``` #[doc(alias = "PushStyleVar")] - pub fn push_style_var(&self, style_var: StyleVar) -> StyleStackToken { + pub fn push_style_var(&self, style_var: StyleVar) -> StyleStackToken<'_> { unsafe { push_style_var(style_var) }; StyleStackToken::new(self) } @@ -196,7 +196,7 @@ pub struct MultiColorStackToken { impl MultiColorStackToken { /// Pops changes from the color stack #[doc(alias = "PopStyleColor")] - pub fn pop(mut self, _: &Ui) { + pub fn pop(mut self, _: &Ui<'_>) { self.ctx = ptr::null(); unsafe { sys::igPopStyleColor(self.count as i32) }; } @@ -236,7 +236,7 @@ pub struct MultiStyleStackToken { impl MultiStyleStackToken { /// Pops changes from the style stack #[doc(alias = "PopStyleVar")] - pub fn pop(mut self, _: &Ui) { + pub fn pop(mut self, _: &Ui<'_>) { self.ctx = ptr::null(); unsafe { sys::igPopStyleVar(self.count as i32) }; } @@ -380,7 +380,7 @@ pub struct ItemWidthStackToken { impl ItemWidthStackToken { /// Pops a change from the item width stack #[doc(alias = "PopItemWidth")] - pub fn pop(mut self, _: &Ui) { + pub fn pop(mut self, _: &Ui<'_>) { self._ctx = ptr::null(); unsafe { sys::igPopItemWidth() }; } @@ -394,7 +394,7 @@ pub struct TextWrapPosStackToken { impl TextWrapPosStackToken { /// Pops a change from the text wrap position stack #[doc(alias = "PopTextWrapPos")] - pub fn pop(mut self, _: &Ui) { + pub fn pop(mut self, _: &Ui<'_>) { self._ctx = ptr::null(); unsafe { sys::igPopTextWrapPos() }; } @@ -410,7 +410,7 @@ impl ItemFlagsStackToken { /// Pops a change from the item flags stack #[doc(alias = "PopAllowKeyboardFocus", alias = "PopButtonRepeat")] - pub fn pop(mut self, _: &Ui) { + pub fn pop(mut self, _: &Ui<'_>) { self._ctx = ptr::null(); const ALLOW_KEYBOARD_FOCUS: ItemFlag = ItemFlag::AllowKeyboardFocus(true); const BUTTON_REPEAT: ItemFlag = ItemFlag::ButtonRepeat(true); diff --git a/imgui/src/string.rs b/imgui/src/string.rs index 1ba181b..d124d85 100644 --- a/imgui/src/string.rs +++ b/imgui/src/string.rs @@ -305,14 +305,14 @@ impl Index for ImString { impl fmt::Debug for ImString { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(self.to_str(), f) } } impl fmt::Display for ImString { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(self.to_str(), f) } } @@ -359,14 +359,14 @@ impl<'a> Default for &'a ImStr { impl fmt::Debug for ImStr { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.0, f) } } impl fmt::Display for ImStr { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(self.to_str(), f) } } diff --git a/imgui/src/widget/color_editors.rs b/imgui/src/widget/color_editors.rs index 1d8949a..0790634 100644 --- a/imgui/src/widget/color_editors.rs +++ b/imgui/src/widget/color_editors.rs @@ -318,7 +318,7 @@ impl<'a, T: AsRef + 'a> ColorEdit<'a, T> { /// Builds the color editor. /// /// Returns true if the color value was changed. - pub fn build(mut self, ui: &Ui) -> bool { + pub fn build(mut self, ui: &Ui<'_>) -> bool { if let EditableColor::Float3(_) = self.value { self.flags.insert(ColorEditFlags::NO_ALPHA); } @@ -506,7 +506,7 @@ impl<'a, T: AsRef> ColorPicker<'a, T> { /// Builds the color picker. /// /// Returns true if the color value was changed. - pub fn build(mut self, ui: &Ui) -> bool { + pub fn build(mut self, ui: &Ui<'_>) -> bool { if let EditableColor::Float3(_) = self.value { self.flags.insert(ColorEditFlags::NO_ALPHA); } @@ -621,7 +621,7 @@ impl> ColorButton { /// Builds the color button. /// /// Returns true if this color button was clicked. - pub fn build(self, ui: &Ui) -> bool { + pub fn build(self, ui: &Ui<'_>) -> bool { unsafe { sys::igColorButton( ui.scratch_txt(self.desc_id), diff --git a/imgui/src/widget/combo_box.rs b/imgui/src/widget/combo_box.rs index 557ccf3..342ef69 100644 --- a/imgui/src/widget/combo_box.rs +++ b/imgui/src/widget/combo_box.rs @@ -162,7 +162,7 @@ impl, Preview: AsRef> ComboBox { /// Returns the result of the closure, if it is called. /// /// Note: the closure is not called if the combo box is not open. - pub fn build R>(self, ui: &Ui, f: F) -> Option { + pub fn build R>(self, ui: &Ui<'_>, f: F) -> Option { self.begin(ui).map(|_combo| f()) } } diff --git a/imgui/src/widget/drag.rs b/imgui/src/widget/drag.rs index 6f9c531..a861365 100644 --- a/imgui/src/widget/drag.rs +++ b/imgui/src/widget/drag.rs @@ -66,7 +66,7 @@ impl, T: DataTypeKind, F: AsRef> Drag { /// Builds a drag slider that is bound to the given value. /// /// Returns true if the slider value was changed. - pub fn build(self, ui: &Ui, value: &mut T) -> bool { + pub fn build(self, ui: &Ui<'_>, value: &mut T) -> bool { unsafe { let (one, two) = ui.scratch_txt_with_opt(self.label, self.display_format); @@ -91,7 +91,7 @@ impl, T: DataTypeKind, F: AsRef> Drag { /// Builds a horizontal array of multiple drag sliders attached to the given slice. /// /// Returns true if any slider value was changed. - pub fn build_array(self, ui: &Ui, values: &mut [T]) -> bool { + pub fn build_array(self, ui: &Ui<'_>, values: &mut [T]) -> bool { unsafe { let (one, two) = ui.scratch_txt_with_opt(self.label, self.display_format); @@ -208,7 +208,7 @@ where /// /// Returns true if the slider value was changed. #[doc(alias = "DragFloatRange2")] - pub fn build(self, ui: &Ui, min: &mut f32, max: &mut f32) -> bool { + pub fn build(self, ui: &Ui<'_>, min: &mut f32, max: &mut f32) -> bool { let label; let mut display_format = std::ptr::null(); let mut max_display_format = std::ptr::null(); @@ -251,7 +251,7 @@ where /// /// Returns true if the slider value was changed. #[doc(alias = "DragIntRange2")] - pub fn build(self, ui: &Ui, min: &mut i32, max: &mut i32) -> bool { + pub fn build(self, ui: &Ui<'_>, min: &mut i32, max: &mut i32) -> bool { unsafe { let label; let mut display_format = std::ptr::null(); diff --git a/imgui/src/widget/image.rs b/imgui/src/widget/image.rs index 566f00c..dd4c58b 100644 --- a/imgui/src/widget/image.rs +++ b/imgui/src/widget/image.rs @@ -55,7 +55,7 @@ impl Image { self } /// Builds the image - pub fn build(self, _: &Ui) { + pub fn build(self, _: &Ui<'_>) { unsafe { sys::igImage( self.texture_id.id() as *mut c_void, @@ -131,7 +131,7 @@ impl ImageButton { self } /// Builds the image button - pub fn build(self, _: &Ui) -> bool { + pub fn build(self, _: &Ui<'_>) -> bool { unsafe { sys::igImageButton( self.texture_id.id() as *mut c_void, diff --git a/imgui/src/widget/list_box.rs b/imgui/src/widget/list_box.rs index 70fbce5..0485e6d 100644 --- a/imgui/src/widget/list_box.rs +++ b/imgui/src/widget/list_box.rs @@ -70,7 +70,7 @@ impl> ListBox { /// Builds a simple list box for choosing from a slice of values pub fn build_simple( self, - ui: &Ui, + ui: &Ui<'_>, current_item: &mut usize, items: &[V], label_fn: &L, diff --git a/imgui/src/widget/menu.rs b/imgui/src/widget/menu.rs index 8404263..0ac02e5 100644 --- a/imgui/src/widget/menu.rs +++ b/imgui/src/widget/menu.rs @@ -167,7 +167,7 @@ impl, Shortcut: AsRef> MenuItem { /// /// Returns true if the menu item is activated. #[doc(alias = "MenuItemBool")] - pub fn build(self, ui: &Ui) -> bool { + pub fn build(self, ui: &Ui<'_>) -> bool { unsafe { let (label, shortcut) = ui.scratch_txt_with_opt(self.label, self.shortcut); sys::igMenuItem_Bool(label, shortcut, self.selected, self.enabled) @@ -176,7 +176,7 @@ impl, Shortcut: AsRef> MenuItem { #[doc(alias = "MenuItemBool")] /// Builds the menu item using a mutable reference to selected state. - pub fn build_with_ref(self, ui: &Ui, selected: &mut bool) -> bool { + pub fn build_with_ref(self, ui: &Ui<'_>, selected: &mut bool) -> bool { if self.selected(*selected).build(ui) { *selected = !*selected; true diff --git a/imgui/src/widget/progress_bar.rs b/imgui/src/widget/progress_bar.rs index 7995d9d..dd6cba2 100644 --- a/imgui/src/widget/progress_bar.rs +++ b/imgui/src/widget/progress_bar.rs @@ -61,7 +61,7 @@ impl> ProgressBar { } /// Builds the progress bar - pub fn build(self, ui: &Ui) { + pub fn build(self, ui: &Ui<'_>) { unsafe { sys::igProgressBar( self.fraction, diff --git a/imgui/src/widget/selectable.rs b/imgui/src/widget/selectable.rs index 0d2ae82..ef0c172 100644 --- a/imgui/src/widget/selectable.rs +++ b/imgui/src/widget/selectable.rs @@ -107,7 +107,7 @@ impl> Selectable { /// Builds the selectable. /// /// Returns true if the selectable was clicked. - pub fn build(self, ui: &Ui) -> bool { + pub fn build(self, ui: &Ui<'_>) -> bool { unsafe { sys::igSelectable_Bool( ui.scratch_txt(self.label), @@ -119,7 +119,7 @@ impl> Selectable { } /// Builds the selectable using a mutable reference to selected state. - pub fn build_with_ref(self, ui: &Ui, selected: &mut bool) -> bool { + pub fn build_with_ref(self, ui: &Ui<'_>, selected: &mut bool) -> bool { if self.selected(*selected).build(ui) { *selected = !*selected; true diff --git a/imgui/src/widget/slider.rs b/imgui/src/widget/slider.rs index d245046..231dd6b 100644 --- a/imgui/src/widget/slider.rs +++ b/imgui/src/widget/slider.rs @@ -95,7 +95,7 @@ where /// Builds a slider that is bound to the given value. /// /// Returns true if the slider value was changed. - pub fn build(self, ui: &Ui, value: &mut Data) -> bool { + pub fn build(self, ui: &Ui<'_>, value: &mut Data) -> bool { unsafe { let (label, display_format) = ui.scratch_txt_with_opt(self.label, self.display_format); @@ -113,7 +113,7 @@ where /// Builds a horizontal array of multiple sliders attached to the given slice. /// /// Returns true if any slider value was changed. - pub fn build_array(self, ui: &Ui, values: &mut [Data]) -> bool { + pub fn build_array(self, ui: &Ui<'_>, values: &mut [Data]) -> bool { unsafe { let (label, display_format) = ui.scratch_txt_with_opt(self.label, self.display_format); @@ -221,7 +221,7 @@ where /// Builds a vertical slider that is bound to the given value. /// /// Returns true if the slider value was changed. - pub fn build(self, ui: &Ui, value: &mut Data) -> bool { + pub fn build(self, ui: &Ui<'_>, value: &mut Data) -> bool { unsafe { let (label, display_format) = ui.scratch_txt_with_opt(self.label, self.display_format); @@ -325,7 +325,7 @@ where /// Builds an angle slider that is bound to the given value (in radians). /// /// Returns true if the slider value was changed. - pub fn build(self, ui: &Ui, value_rad: &mut f32) -> bool { + pub fn build(self, ui: &Ui<'_>, value_rad: &mut f32) -> bool { unsafe { let (label, display_format) = ui.scratch_txt_two(self.label, self.display_format); diff --git a/imgui/src/widget/tree.rs b/imgui/src/widget/tree.rs index 7421d03..06abafc 100644 --- a/imgui/src/widget/tree.rs +++ b/imgui/src/widget/tree.rs @@ -408,7 +408,7 @@ impl> CollapsingHeader { /// /// This is the same as [build](Self::build) but is provided for consistent naming. #[must_use] - pub fn begin(self, ui: &Ui) -> bool { + pub fn begin(self, ui: &Ui<'_>) -> bool { self.build(ui) } @@ -419,7 +419,7 @@ impl> CollapsingHeader { /// This is the same as [build_with_close_button](Self::build_with_close_button) /// but is provided for consistent naming. #[must_use] - pub fn begin_with_close_button(self, ui: &Ui, opened: &mut bool) -> bool { + pub fn begin_with_close_button(self, ui: &Ui<'_>, opened: &mut bool) -> bool { self.build_with_close_button(ui, opened) } @@ -428,7 +428,7 @@ impl> CollapsingHeader { /// Returns true if the collapsing header is open and content should be rendered. #[must_use] #[inline] - pub fn build(self, ui: &Ui) -> bool { + pub fn build(self, ui: &Ui<'_>) -> bool { unsafe { sys::igCollapsingHeader_TreeNodeFlags( ui.scratch_txt(self.label), @@ -442,7 +442,7 @@ impl> CollapsingHeader { /// Returns true if the collapsing header is open and content should be rendered. #[must_use] #[inline] - pub fn build_with_close_button(self, ui: &Ui, opened: &mut bool) -> bool { + pub fn build_with_close_button(self, ui: &Ui<'_>, opened: &mut bool) -> bool { unsafe { sys::igCollapsingHeader_BoolPtr( ui.scratch_txt(self.label),