diff --git a/hui-examples/examples/mom_downloader.rs b/hui-examples/examples/mom_downloader.rs index 2061bfe..d26824c 100644 --- a/hui-examples/examples/mom_downloader.rs +++ b/hui-examples/examples/mom_downloader.rs @@ -1,11 +1,15 @@ use std::time::Instant; use hui::{ - color, element::{ + color, + element::{ container::Container, progress_bar::ProgressBar, text::Text, UiElementExt, - }, frame::RectFrame, rect_frame, layout::{Alignment, Direction}, size + }, + layout::{Alignment, Direction}, + rect_frame, + size }; #[path = "../boilerplate.rs"] diff --git a/hui-examples/examples/ui_test.rs b/hui-examples/examples/ui_test.rs index cfc33c6..7b4cbde 100644 --- a/hui-examples/examples/ui_test.rs +++ b/hui-examples/examples/ui_test.rs @@ -1,7 +1,6 @@ use hui::{ color, size, rect_frame, element::{container::Container, text::Text, UiElementExt}, - frame::RectFrame, layout::Alignment, }; diff --git a/hui-examples/examples/ui_test_2_loading.rs b/hui-examples/examples/ui_test_2_loading.rs index 8f11033..ce90ca0 100644 --- a/hui-examples/examples/ui_test_2_loading.rs +++ b/hui-examples/examples/ui_test_2_loading.rs @@ -8,7 +8,6 @@ use hui::{ text::Text, UiElementExt }, - frame::RectFrame, layout::Alignment, rect::Corners, text::FontHandle diff --git a/hui-examples/examples/ui_test_3_transform.rs b/hui-examples/examples/ui_test_3_transform.rs index eb8f392..44a85bf 100644 --- a/hui-examples/examples/ui_test_3_transform.rs +++ b/hui-examples/examples/ui_test_3_transform.rs @@ -7,7 +7,12 @@ use hui::{ text::Text, transformer::ElementTransformExt, UiElementExt - }, frame::RectFrame, rect_frame, layout::Alignment, rect::Corners, size, text::FontHandle + }, + layout::Alignment, + rect::Corners, + text::FontHandle, + rect_frame, + size, }; #[path = "../boilerplate.rs"] diff --git a/hui-painter/src/paint/command/rectangle.rs b/hui-painter/src/paint/command/rectangle.rs index 189ef47..45e1d92 100644 --- a/hui-painter/src/paint/command/rectangle.rs +++ b/hui-painter/src/paint/command/rectangle.rs @@ -1,5 +1,5 @@ use std::num::NonZeroU16; -use glam::{vec2, Vec2, Vec4}; +use glam::{vec2, Vec2}; use hui_shared::{color, rect::{Corners, FillColor}}; use crate::{ paint::{ @@ -99,8 +99,7 @@ impl PaintCommand for PaintRectangle { // Otherwise, if texture handle is not set or invalid, use the bottom left // corner of the texture which contains a white pixel. let uvs = self.texture - .map(|handle| ctx.atlas.get_uv(handle)) - .flatten() + .and_then(|handle| ctx.atlas.get_uv(handle)) .map(|global_uv| { let texture_uv = self.texture_uv; let texture_uv_is_default = @@ -155,7 +154,7 @@ impl PaintCommand for PaintRectangle { // No border radius: // Draw a simple quad (2 tris) let indices = Corners { - top_left: idx_base + 0, + top_left: idx_base, top_right: idx_base + 1, bottom_left: idx_base + 2, bottom_right: idx_base + 3, diff --git a/hui-painter/src/paint/command/text.rs b/hui-painter/src/paint/command/text.rs index 6a09765..5c8dcef 100644 --- a/hui-painter/src/paint/command/text.rs +++ b/hui-painter/src/paint/command/text.rs @@ -43,7 +43,7 @@ impl PaintText { fn build_layout(&self, font_array: &[&fontdue::Font]) -> Layout { let mut layout = Layout::new(CoordinateSystem::PositiveYDown); layout.append( - &font_array, + font_array, &fontdue::layout::TextStyle::new( &self.text.text, self.text.size, diff --git a/hui-painter/src/text/ftm.rs b/hui-painter/src/text/ftm.rs index 130fc17..022b424 100644 --- a/hui-painter/src/text/ftm.rs +++ b/hui-painter/src/text/ftm.rs @@ -83,7 +83,7 @@ impl FontTextureManager { let itm = RasterizedGlyphInternal { handle, metrics }; unsafe { partition.insert_unique_unchecked(config, itm); } - return handle; + handle } } diff --git a/hui/src/draw.rs b/hui/src/draw.rs index e7c9d1f..580da98 100644 --- a/hui/src/draw.rs +++ b/hui/src/draw.rs @@ -145,8 +145,8 @@ impl UiDrawCall { //Kinda a hack: //We want to apply the transform aronnd the center, so we need to compute the center of the vertices //We won't actually do that, we will compute the center of the bounding box of the vertices - let mut min = Vec2::splat(std::f32::INFINITY); - let mut max = Vec2::splat(std::f32::NEG_INFINITY); + let mut min = Vec2::splat(f32::INFINITY); + let mut max = Vec2::splat(f32::NEG_INFINITY); for v in &draw_call.vertices[idx as usize..] { min = min.min(v.position); max = max.max(v.position); diff --git a/hui/src/element/builtin/slider.rs b/hui/src/element/builtin/slider.rs index ea9e31a..14a5710 100644 --- a/hui/src/element/builtin/slider.rs +++ b/hui/src/element/builtin/slider.rs @@ -4,10 +4,13 @@ use derive_setters::Setters; use glam::{Vec2, vec2}; use crate::{ - draw::UiDrawCommand, element::{MeasureContext, ProcessContext, UiElement}, frame::{Frame, RectFrame}, layout::{compute_size, Size2d}, measure::Response, rect::FillColor, signal::{trigger::SignalTriggerArg, Signal} + element::{MeasureContext, ProcessContext, UiElement}, + frame::{Frame, RectFrame}, + layout::{compute_size, Size2d}, + measure::Response, + signal::{trigger::SignalTriggerArg, Signal}, }; - //TODO: use state for slider? // ^ useful if the user only hanldes the drag end event or has large step sizes with relative mode diff --git a/hui/src/element/builtin/text.rs b/hui/src/element/builtin/text.rs index 48784cd..303c859 100644 --- a/hui/src/element/builtin/text.rs +++ b/hui/src/element/builtin/text.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; use derive_setters::Setters; -use glam::{vec2, Vec4}; +use glam::Vec4; use crate::{ draw::UiDrawCommand, element::{MeasureContext, ProcessContext, UiElement}, diff --git a/hui/src/input.rs b/hui/src/input.rs index 8154e81..12f3ede 100644 --- a/hui/src/input.rs +++ b/hui/src/input.rs @@ -256,7 +256,7 @@ pub struct ActiveCheckResponse { #[derive(Clone, Copy)] pub struct InputCtx<'a>(&'a UiInputState); -impl<'a> InputCtx<'a> { +impl InputCtx<'_> { /// Get the current position of the mouse pointer /// /// Do not use this function to check for hover, use [`InputCtx::check_hover`] instead diff --git a/hui/src/instance.rs b/hui/src/instance.rs index 4cf4126..6050e5f 100644 --- a/hui/src/instance.rs +++ b/hui/src/instance.rs @@ -1,4 +1,3 @@ -use glam::Vec2; use crate::{ element::{MeasureContext, ProcessContext, UiElement}, layout::{Direction, LayoutInfo}, diff --git a/hui/src/text.rs b/hui/src/text.rs index 89f485a..55760a1 100644 --- a/hui/src/text.rs +++ b/hui/src/text.rs @@ -74,7 +74,7 @@ pub struct TextMeasureResponse { #[derive(Clone, Copy)] pub struct TextMeasure<'a>(&'a TextRenderer); -impl<'a> TextMeasure<'a> { +impl TextMeasure<'_> { /// Measure the given string of text with the given font and size pub fn measure(&self, font: FontHandle, size: u16, text: &str) -> TextMeasureResponse { use fontdue::layout::{Layout, CoordinateSystem, TextStyle};