Fix some lints found by clippy 1.73

This commit is contained in:
Emil Ernerfeldt 2023-10-06 09:01:31 +02:00
parent 12b6f2c3a0
commit 2bc2fb9c39
11 changed files with 21 additions and 26 deletions

View File

@ -332,12 +332,12 @@ impl Resize {
use epaint::Stroke;
pub fn paint_resize_corner(ui: &mut Ui, response: &Response) {
pub fn paint_resize_corner(ui: &Ui, response: &Response) {
let stroke = ui.style().interact(response).fg_stroke;
paint_resize_corner_with_style(ui, &response.rect, stroke, Align2::RIGHT_BOTTOM);
}
pub fn paint_resize_corner_with_style(ui: &mut Ui, rect: &Rect, stroke: Stroke, corner: Align2) {
pub fn paint_resize_corner_with_style(ui: &Ui, rect: &Rect, stroke: Stroke, corner: Align2) {
let painter = ui.painter();
let cp = painter.round_pos_to_pixels(corner.pos_in_rect(rect));
let mut w = 2.0;

View File

@ -429,7 +429,7 @@ impl<'open> Window<'open> {
.map_or((None, None), |ir| (Some(ir.inner), Some(ir.response)));
let outer_rect = frame.end(&mut area_content_ui).rect;
paint_resize_corner(&mut area_content_ui, &possible, outer_rect, frame_stroke);
paint_resize_corner(&area_content_ui, &possible, outer_rect, frame_stroke);
// END FRAME --------------------------------
@ -448,7 +448,7 @@ impl<'open> Window<'open> {
if let Some(interaction) = interaction {
paint_frame_interaction(
&mut area_content_ui,
&area_content_ui,
outer_rect,
interaction,
ctx.style().visuals.widgets.active,
@ -456,7 +456,7 @@ impl<'open> Window<'open> {
} else if let Some(hover_interaction) = hover_interaction {
if ctx.input(|i| i.pointer.has_pointer()) {
paint_frame_interaction(
&mut area_content_ui,
&area_content_ui,
outer_rect,
hover_interaction,
ctx.style().visuals.widgets.hovered,
@ -476,12 +476,7 @@ impl<'open> Window<'open> {
}
}
fn paint_resize_corner(
ui: &mut Ui,
possible: &PossibleInteractions,
outer_rect: Rect,
stroke: Stroke,
) {
fn paint_resize_corner(ui: &Ui, possible: &PossibleInteractions, outer_rect: Rect, stroke: Stroke) {
let corner = if possible.resize_right && possible.resize_bottom {
Align2::RIGHT_BOTTOM
} else if possible.resize_left && possible.resize_bottom {
@ -758,7 +753,7 @@ fn resize_hover(
/// Fill in parts of the window frame when we resize by dragging that part
fn paint_frame_interaction(
ui: &mut Ui,
ui: &Ui,
rect: Rect,
interaction: WindowInteraction,
visuals: style::WidgetVisuals,

View File

@ -1284,7 +1284,7 @@ impl Context {
});
#[cfg_attr(not(feature = "accesskit"), allow(unused_mut))]
let mut platform_output: PlatformOutput = self.output_mut(|o| std::mem::take(o));
let mut platform_output: PlatformOutput = self.output_mut(std::mem::take);
#[cfg(feature = "accesskit")]
{

View File

@ -221,7 +221,7 @@ impl GridLayout {
self.col += 1;
}
fn paint_row(&mut self, cursor: &mut Rect, painter: &Painter) {
fn paint_row(&mut self, cursor: &Rect, painter: &Painter) {
// handle row color painting based on color-picker function
let Some(color_picker) = self.color_picker.as_ref() else {
return;
@ -433,9 +433,9 @@ impl Grid {
// paint first incoming row
if is_color {
let mut cursor = ui.cursor();
let cursor = ui.cursor();
let painter = ui.painter();
grid.paint_row(&mut cursor, painter);
grid.paint_row(&cursor, painter);
}
ui.set_grid(grid);

View File

@ -608,7 +608,7 @@ impl MenuState {
}
/// Sense button interaction opening and closing submenu.
fn submenu_button_interaction(&mut self, ui: &mut Ui, sub_id: Id, button: &Response) {
fn submenu_button_interaction(&mut self, ui: &Ui, sub_id: Id, button: &Response) {
let pointer = ui.input(|i| i.pointer.clone());
let open = self.is_open(sub_id);
if self.moving_towards_current_submenu(&pointer) {

View File

@ -317,7 +317,7 @@ fn color_picker_hsvag_2d(ui: &mut Ui, hsva: &mut HsvaGamma, alpha: Alpha) {
color_slider_2d(ui, s, v, |s, v| HsvaGamma { s, v, ..opaque }.into());
}
//// Shows a color picker where the user can change the given [`Hsva`] color.
/// Shows a color picker where the user can change the given [`Hsva`] color.
///
/// Returns `true` on change.
pub fn color_picker_hsva_2d(ui: &mut Ui, hsva: &mut Hsva, alpha: Alpha) -> bool {

View File

@ -269,7 +269,7 @@ impl<'a> Image<'a> {
self.size.calc_size(available_size, original_image_size)
}
pub fn load_and_calc_size(&self, ui: &mut Ui, available_size: Vec2) -> Option<Vec2> {
pub fn load_and_calc_size(&self, ui: &Ui, available_size: Vec2) -> Option<Vec2> {
let image_size = self.load_for_size(ui.ctx(), available_size).ok()?.size()?;
Some(self.size.calc_size(available_size, image_size))
}
@ -317,7 +317,7 @@ impl<'a> Image<'a> {
/// # });
/// ```
#[inline]
pub fn paint_at(&self, ui: &mut Ui, rect: Rect) {
pub fn paint_at(&self, ui: &Ui, rect: Rect) {
paint_texture_load_result(
ui,
&self.load_for_size(ui.ctx(), rect.size()),

View File

@ -548,7 +548,7 @@ impl<'a> Slider<'a> {
}
/// Just the slider, no text
fn slider_ui(&mut self, ui: &mut Ui, response: &Response) {
fn slider_ui(&mut self, ui: &Ui, response: &Response) {
let rect = &response.rect;
let position_range = self.position_range(rect);

View File

@ -876,7 +876,7 @@ fn ccursor_from_accesskit_text_position(
/// Check for (keyboard) events to edit the cursor and/or text.
#[allow(clippy::too_many_arguments)]
fn events(
ui: &mut crate::Ui,
ui: &crate::Ui,
state: &mut TextEditState,
text: &mut dyn TextBuffer,
galley: &mut Arc<Galley>,
@ -1089,7 +1089,7 @@ fn events(
// ----------------------------------------------------------------------------
fn paint_cursor_selection(
ui: &mut Ui,
ui: &Ui,
painter: &Painter,
pos: Pos2,
galley: &Galley,
@ -1131,7 +1131,7 @@ fn paint_cursor_selection(
}
fn paint_cursor_end(
ui: &mut Ui,
ui: &Ui,
row_height: f32,
painter: &Painter,
pos: Pos2,

View File

@ -62,7 +62,7 @@ pub struct BackendPanel {
}
impl BackendPanel {
pub fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
pub fn update(&mut self, ctx: &egui::Context, frame: &eframe::Frame) {
self.frame_history
.on_new_frame(ctx.input(|i| i.time), frame.info().cpu_usage);

View File

@ -665,7 +665,7 @@ fn tessellate_row(
point_scale: PointScale,
job: &LayoutJob,
format_summary: &FormatSummary,
row: &mut Row,
row: &Row,
) -> RowVisuals {
if row.glyphs.is_empty() {
return Default::default();