diff --git a/crates/egui/src/layout.rs b/crates/egui/src/layout.rs index 5981ff52402..0293904ec0a 100644 --- a/crates/egui/src/layout.rs +++ b/crates/egui/src/layout.rs @@ -765,7 +765,7 @@ impl Layout { /// Move to the next row in a wrapping layout. /// Otherwise does nothing. - pub(crate) fn end_row(&mut self, region: &mut Region, spacing: Vec2) { + pub(crate) fn end_row(&self, region: &mut Region, spacing: Vec2) { if self.main_wrap { match self.main_dir { Direction::LeftToRight => { @@ -788,7 +788,7 @@ impl Layout { } /// Set row height in horizontal wrapping layout. - pub(crate) fn set_row_height(&mut self, region: &mut Region, height: f32) { + pub(crate) fn set_row_height(&self, region: &mut Region, height: f32) { if self.main_wrap && self.is_horizontal() { region.cursor.max.y = region.cursor.min.y + height; } diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 0f6aa3e533f..0d586df25a0 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -349,7 +349,7 @@ impl MenuRoot { } pub fn show( - &mut self, + &self, button: &Response, add_contents: impl FnOnce(&mut Ui) -> R, ) -> (MenuResponse, Option>) { @@ -759,7 +759,7 @@ impl MenuState { self.sub_menu.as_ref().map(|(_, sub)| sub) } - fn submenu(&mut self, id: Id) -> Option<&Arc>> { + fn submenu(&self, id: Id) -> Option<&Arc>> { self.sub_menu .as_ref() .and_then(|(k, sub)| if id == *k { Some(sub) } else { None }) diff --git a/crates/egui/src/widgets/text_edit/state.rs b/crates/egui/src/widgets/text_edit/state.rs index cef845afcc5..e73664a1293 100644 --- a/crates/egui/src/widgets/text_edit/state.rs +++ b/crates/egui/src/widgets/text_edit/state.rs @@ -98,7 +98,7 @@ impl TextEditState { } #[deprecated = "Use `self.cursor.range` instead"] - pub fn cursor_range(&mut self, galley: &Galley) -> Option { + pub fn cursor_range(&self, galley: &Galley) -> Option { self.cursor.range(galley) } } diff --git a/crates/egui_demo_app/src/frame_history.rs b/crates/egui_demo_app/src/frame_history.rs index ddbb2794c03..535d6d9f95f 100644 --- a/crates/egui_demo_app/src/frame_history.rs +++ b/crates/egui_demo_app/src/frame_history.rs @@ -52,7 +52,7 @@ impl FrameHistory { } } - fn graph(&mut self, ui: &mut egui::Ui) -> egui::Response { + fn graph(&self, ui: &mut egui::Ui) -> egui::Response { use egui::{emath, epaint, pos2, vec2, Pos2, Rect, Sense, Shape, Stroke, TextStyle}; ui.label("egui CPU usage history"); diff --git a/crates/egui_demo_lib/src/rendering_test.rs b/crates/egui_demo_lib/src/rendering_test.rs index 70fd9983768..3ae4f111808 100644 --- a/crates/egui_demo_lib/src/rendering_test.rs +++ b/crates/egui_demo_lib/src/rendering_test.rs @@ -254,7 +254,7 @@ impl ColorTest { }); } - fn vertex_gradient(&mut self, ui: &mut Ui, label: &str, bg_fill: Color32, gradient: &Gradient) { + fn vertex_gradient(&self, ui: &mut Ui, label: &str, bg_fill: Color32, gradient: &Gradient) { if !self.vertex_gradients { return; } diff --git a/crates/egui_extras/src/loaders.rs b/crates/egui_extras/src/loaders.rs index c119d217cee..02683e442e7 100644 --- a/crates/egui_extras/src/loaders.rs +++ b/crates/egui_extras/src/loaders.rs @@ -16,7 +16,7 @@ /// /// - If you just want to be able to load `file://` and `http://` URIs, enable the `all_loaders` feature. /// - The supported set of image formats is configured by adding the [`image`](https://crates.io/crates/image) -/// crate as your direct dependency, and enabling features on it: +/// crate as your direct dependency, and enabling features on it: /// /// ```toml,ignore /// egui_extras = { version = "*", features = ["all_loaders"] } diff --git a/crates/egui_extras/src/table.rs b/crates/egui_extras/src/table.rs index 9fff73b2573..c8b8c5006a6 100644 --- a/crates/egui_extras/src/table.rs +++ b/crates/egui_extras/src/table.rs @@ -439,7 +439,7 @@ impl<'a> TableBuilder<'a> { } /// Reset all column widths. - pub fn reset(&mut self) { + pub fn reset(&self) { let state_id = self.ui.id().with(self.id_salt); TableState::reset(self.ui, state_id); } diff --git a/crates/epaint/src/lib.rs b/crates/epaint/src/lib.rs index 42f78531e88..4dee42381cd 100644 --- a/crates/epaint/src/lib.rs +++ b/crates/epaint/src/lib.rs @@ -77,6 +77,7 @@ pub use emath; pub use ecolor::hex_color; /// The UV coordinate of a white region of the texture mesh. +/// /// The default egui texture has the top-left corner pixel fully white. /// You need need use a clamping texture sampler for this to work /// (so it doesn't do bilinear blending with bottom right corner). diff --git a/crates/epaint/src/mesh.rs b/crates/epaint/src/mesh.rs index 10b724b9045..ba37e715856 100644 --- a/crates/epaint/src/mesh.rs +++ b/crates/epaint/src/mesh.rs @@ -222,7 +222,7 @@ impl Mesh { pub fn split_to_u16(self) -> Vec { debug_assert!(self.is_valid()); - const MAX_SIZE: u32 = std::u16::MAX as u32; + const MAX_SIZE: u32 = u16::MAX as u32; if self.vertices.len() <= MAX_SIZE as usize { // Common-case optimization: diff --git a/crates/epaint/src/tessellator.rs b/crates/epaint/src/tessellator.rs index 260745fff00..0c15b7dba09 100644 --- a/crates/epaint/src/tessellator.rs +++ b/crates/epaint/src/tessellator.rs @@ -1537,7 +1537,7 @@ impl Tessellator { /// /// * `mesh`: the mesh to tessellate. /// * `out`: triangles are appended to this. - pub fn tessellate_mesh(&mut self, mesh: &Mesh, out: &mut Mesh) { + pub fn tessellate_mesh(&self, mesh: &Mesh, out: &mut Mesh) { if !mesh.is_valid() { debug_assert!(false, "Invalid Mesh in Shape::Mesh"); return;