Fix some minor clippy lints from the future

This commit is contained in:
Emil Ernerfeldt 2024-09-18 09:44:23 +02:00
parent 1474c17b0d
commit 4dd89e2052
10 changed files with 12 additions and 11 deletions

View File

@ -765,7 +765,7 @@ impl Layout {
/// Move to the next row in a wrapping layout. /// Move to the next row in a wrapping layout.
/// Otherwise does nothing. /// 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 { if self.main_wrap {
match self.main_dir { match self.main_dir {
Direction::LeftToRight => { Direction::LeftToRight => {
@ -788,7 +788,7 @@ impl Layout {
} }
/// Set row height in horizontal wrapping 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() { if self.main_wrap && self.is_horizontal() {
region.cursor.max.y = region.cursor.min.y + height; region.cursor.max.y = region.cursor.min.y + height;
} }

View File

@ -349,7 +349,7 @@ impl MenuRoot {
} }
pub fn show<R>( pub fn show<R>(
&mut self, &self,
button: &Response, button: &Response,
add_contents: impl FnOnce(&mut Ui) -> R, add_contents: impl FnOnce(&mut Ui) -> R,
) -> (MenuResponse, Option<InnerResponse<R>>) { ) -> (MenuResponse, Option<InnerResponse<R>>) {
@ -759,7 +759,7 @@ impl MenuState {
self.sub_menu.as_ref().map(|(_, sub)| sub) self.sub_menu.as_ref().map(|(_, sub)| sub)
} }
fn submenu(&mut self, id: Id) -> Option<&Arc<RwLock<Self>>> { fn submenu(&self, id: Id) -> Option<&Arc<RwLock<Self>>> {
self.sub_menu self.sub_menu
.as_ref() .as_ref()
.and_then(|(k, sub)| if id == *k { Some(sub) } else { None }) .and_then(|(k, sub)| if id == *k { Some(sub) } else { None })

View File

@ -98,7 +98,7 @@ impl TextEditState {
} }
#[deprecated = "Use `self.cursor.range` instead"] #[deprecated = "Use `self.cursor.range` instead"]
pub fn cursor_range(&mut self, galley: &Galley) -> Option<CursorRange> { pub fn cursor_range(&self, galley: &Galley) -> Option<CursorRange> {
self.cursor.range(galley) self.cursor.range(galley)
} }
} }

View File

@ -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}; use egui::{emath, epaint, pos2, vec2, Pos2, Rect, Sense, Shape, Stroke, TextStyle};
ui.label("egui CPU usage history"); ui.label("egui CPU usage history");

View File

@ -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 { if !self.vertex_gradients {
return; return;
} }

View File

@ -16,7 +16,7 @@
/// ///
/// - If you just want to be able to load `file://` and `http://` URIs, enable the `all_loaders` feature. /// - 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) /// - 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 /// ```toml,ignore
/// egui_extras = { version = "*", features = ["all_loaders"] } /// egui_extras = { version = "*", features = ["all_loaders"] }

View File

@ -439,7 +439,7 @@ impl<'a> TableBuilder<'a> {
} }
/// Reset all column widths. /// Reset all column widths.
pub fn reset(&mut self) { pub fn reset(&self) {
let state_id = self.ui.id().with(self.id_salt); let state_id = self.ui.id().with(self.id_salt);
TableState::reset(self.ui, state_id); TableState::reset(self.ui, state_id);
} }

View File

@ -77,6 +77,7 @@ pub use emath;
pub use ecolor::hex_color; pub use ecolor::hex_color;
/// The UV coordinate of a white region of the texture mesh. /// The UV coordinate of a white region of the texture mesh.
///
/// The default egui texture has the top-left corner pixel fully white. /// The default egui texture has the top-left corner pixel fully white.
/// You need need use a clamping texture sampler for this to work /// You need need use a clamping texture sampler for this to work
/// (so it doesn't do bilinear blending with bottom right corner). /// (so it doesn't do bilinear blending with bottom right corner).

View File

@ -222,7 +222,7 @@ impl Mesh {
pub fn split_to_u16(self) -> Vec<Mesh16> { pub fn split_to_u16(self) -> Vec<Mesh16> {
debug_assert!(self.is_valid()); 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 { if self.vertices.len() <= MAX_SIZE as usize {
// Common-case optimization: // Common-case optimization:

View File

@ -1537,7 +1537,7 @@ impl Tessellator {
/// ///
/// * `mesh`: the mesh to tessellate. /// * `mesh`: the mesh to tessellate.
/// * `out`: triangles are appended to this. /// * `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() { if !mesh.is_valid() {
debug_assert!(false, "Invalid Mesh in Shape::Mesh"); debug_assert!(false, "Invalid Mesh in Shape::Mesh");
return; return;