Skip to content

Commit

Permalink
Fix some minor clippy lints from the future
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Sep 18, 2024
1 parent 1474c17 commit 4dd89e2
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions crates/egui/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/egui/src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl MenuRoot {
}

pub fn show<R>(
&mut self,
&self,
button: &Response,
add_contents: impl FnOnce(&mut Ui) -> R,
) -> (MenuResponse, Option<InnerResponse<R>>) {
Expand Down Expand Up @@ -759,7 +759,7 @@ impl MenuState {
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
.as_ref()
.and_then(|(k, sub)| if id == *k { Some(sub) } else { None })
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/widgets/text_edit/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl TextEditState {
}

#[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)
}
}
2 changes: 1 addition & 1 deletion crates/egui_demo_app/src/frame_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_lib/src/rendering_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_extras/src/loaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_extras/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions crates/epaint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion crates/epaint/src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl Mesh {
pub fn split_to_u16(self) -> Vec<Mesh16> {
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:
Expand Down
2 changes: 1 addition & 1 deletion crates/epaint/src/tessellator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4dd89e2

Please sign in to comment.