Fix some lints found by clippy 1.73
This commit is contained in:
parent
12b6f2c3a0
commit
2bc2fb9c39
|
|
@ -332,12 +332,12 @@ impl Resize {
|
||||||
|
|
||||||
use epaint::Stroke;
|
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;
|
let stroke = ui.style().interact(response).fg_stroke;
|
||||||
paint_resize_corner_with_style(ui, &response.rect, stroke, Align2::RIGHT_BOTTOM);
|
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 painter = ui.painter();
|
||||||
let cp = painter.round_pos_to_pixels(corner.pos_in_rect(rect));
|
let cp = painter.round_pos_to_pixels(corner.pos_in_rect(rect));
|
||||||
let mut w = 2.0;
|
let mut w = 2.0;
|
||||||
|
|
|
||||||
|
|
@ -429,7 +429,7 @@ impl<'open> Window<'open> {
|
||||||
.map_or((None, None), |ir| (Some(ir.inner), Some(ir.response)));
|
.map_or((None, None), |ir| (Some(ir.inner), Some(ir.response)));
|
||||||
|
|
||||||
let outer_rect = frame.end(&mut area_content_ui).rect;
|
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 --------------------------------
|
// END FRAME --------------------------------
|
||||||
|
|
||||||
|
|
@ -448,7 +448,7 @@ impl<'open> Window<'open> {
|
||||||
|
|
||||||
if let Some(interaction) = interaction {
|
if let Some(interaction) = interaction {
|
||||||
paint_frame_interaction(
|
paint_frame_interaction(
|
||||||
&mut area_content_ui,
|
&area_content_ui,
|
||||||
outer_rect,
|
outer_rect,
|
||||||
interaction,
|
interaction,
|
||||||
ctx.style().visuals.widgets.active,
|
ctx.style().visuals.widgets.active,
|
||||||
|
|
@ -456,7 +456,7 @@ impl<'open> Window<'open> {
|
||||||
} else if let Some(hover_interaction) = hover_interaction {
|
} else if let Some(hover_interaction) = hover_interaction {
|
||||||
if ctx.input(|i| i.pointer.has_pointer()) {
|
if ctx.input(|i| i.pointer.has_pointer()) {
|
||||||
paint_frame_interaction(
|
paint_frame_interaction(
|
||||||
&mut area_content_ui,
|
&area_content_ui,
|
||||||
outer_rect,
|
outer_rect,
|
||||||
hover_interaction,
|
hover_interaction,
|
||||||
ctx.style().visuals.widgets.hovered,
|
ctx.style().visuals.widgets.hovered,
|
||||||
|
|
@ -476,12 +476,7 @@ impl<'open> Window<'open> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn paint_resize_corner(
|
fn paint_resize_corner(ui: &Ui, possible: &PossibleInteractions, outer_rect: Rect, stroke: Stroke) {
|
||||||
ui: &mut Ui,
|
|
||||||
possible: &PossibleInteractions,
|
|
||||||
outer_rect: Rect,
|
|
||||||
stroke: Stroke,
|
|
||||||
) {
|
|
||||||
let corner = if possible.resize_right && possible.resize_bottom {
|
let corner = if possible.resize_right && possible.resize_bottom {
|
||||||
Align2::RIGHT_BOTTOM
|
Align2::RIGHT_BOTTOM
|
||||||
} else if possible.resize_left && possible.resize_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
|
/// Fill in parts of the window frame when we resize by dragging that part
|
||||||
fn paint_frame_interaction(
|
fn paint_frame_interaction(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
rect: Rect,
|
rect: Rect,
|
||||||
interaction: WindowInteraction,
|
interaction: WindowInteraction,
|
||||||
visuals: style::WidgetVisuals,
|
visuals: style::WidgetVisuals,
|
||||||
|
|
|
||||||
|
|
@ -1284,7 +1284,7 @@ impl Context {
|
||||||
});
|
});
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "accesskit"), allow(unused_mut))]
|
#[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")]
|
#[cfg(feature = "accesskit")]
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ impl GridLayout {
|
||||||
self.col += 1;
|
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
|
// handle row color painting based on color-picker function
|
||||||
let Some(color_picker) = self.color_picker.as_ref() else {
|
let Some(color_picker) = self.color_picker.as_ref() else {
|
||||||
return;
|
return;
|
||||||
|
|
@ -433,9 +433,9 @@ impl Grid {
|
||||||
|
|
||||||
// paint first incoming row
|
// paint first incoming row
|
||||||
if is_color {
|
if is_color {
|
||||||
let mut cursor = ui.cursor();
|
let cursor = ui.cursor();
|
||||||
let painter = ui.painter();
|
let painter = ui.painter();
|
||||||
grid.paint_row(&mut cursor, painter);
|
grid.paint_row(&cursor, painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.set_grid(grid);
|
ui.set_grid(grid);
|
||||||
|
|
|
||||||
|
|
@ -608,7 +608,7 @@ impl MenuState {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sense button interaction opening and closing submenu.
|
/// 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 pointer = ui.input(|i| i.pointer.clone());
|
||||||
let open = self.is_open(sub_id);
|
let open = self.is_open(sub_id);
|
||||||
if self.moving_towards_current_submenu(&pointer) {
|
if self.moving_towards_current_submenu(&pointer) {
|
||||||
|
|
|
||||||
|
|
@ -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());
|
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.
|
/// Returns `true` on change.
|
||||||
pub fn color_picker_hsva_2d(ui: &mut Ui, hsva: &mut Hsva, alpha: Alpha) -> bool {
|
pub fn color_picker_hsva_2d(ui: &mut Ui, hsva: &mut Hsva, alpha: Alpha) -> bool {
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ impl<'a> Image<'a> {
|
||||||
self.size.calc_size(available_size, original_image_size)
|
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()?;
|
let image_size = self.load_for_size(ui.ctx(), available_size).ok()?.size()?;
|
||||||
Some(self.size.calc_size(available_size, image_size))
|
Some(self.size.calc_size(available_size, image_size))
|
||||||
}
|
}
|
||||||
|
|
@ -317,7 +317,7 @@ impl<'a> Image<'a> {
|
||||||
/// # });
|
/// # });
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn paint_at(&self, ui: &mut Ui, rect: Rect) {
|
pub fn paint_at(&self, ui: &Ui, rect: Rect) {
|
||||||
paint_texture_load_result(
|
paint_texture_load_result(
|
||||||
ui,
|
ui,
|
||||||
&self.load_for_size(ui.ctx(), rect.size()),
|
&self.load_for_size(ui.ctx(), rect.size()),
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,7 @@ impl<'a> Slider<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Just the slider, no text
|
/// 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 rect = &response.rect;
|
||||||
let position_range = self.position_range(rect);
|
let position_range = self.position_range(rect);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -876,7 +876,7 @@ fn ccursor_from_accesskit_text_position(
|
||||||
/// Check for (keyboard) events to edit the cursor and/or text.
|
/// Check for (keyboard) events to edit the cursor and/or text.
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn events(
|
fn events(
|
||||||
ui: &mut crate::Ui,
|
ui: &crate::Ui,
|
||||||
state: &mut TextEditState,
|
state: &mut TextEditState,
|
||||||
text: &mut dyn TextBuffer,
|
text: &mut dyn TextBuffer,
|
||||||
galley: &mut Arc<Galley>,
|
galley: &mut Arc<Galley>,
|
||||||
|
|
@ -1089,7 +1089,7 @@ fn events(
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
fn paint_cursor_selection(
|
fn paint_cursor_selection(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
painter: &Painter,
|
painter: &Painter,
|
||||||
pos: Pos2,
|
pos: Pos2,
|
||||||
galley: &Galley,
|
galley: &Galley,
|
||||||
|
|
@ -1131,7 +1131,7 @@ fn paint_cursor_selection(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn paint_cursor_end(
|
fn paint_cursor_end(
|
||||||
ui: &mut Ui,
|
ui: &Ui,
|
||||||
row_height: f32,
|
row_height: f32,
|
||||||
painter: &Painter,
|
painter: &Painter,
|
||||||
pos: Pos2,
|
pos: Pos2,
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ pub struct BackendPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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
|
self.frame_history
|
||||||
.on_new_frame(ctx.input(|i| i.time), frame.info().cpu_usage);
|
.on_new_frame(ctx.input(|i| i.time), frame.info().cpu_usage);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -665,7 +665,7 @@ fn tessellate_row(
|
||||||
point_scale: PointScale,
|
point_scale: PointScale,
|
||||||
job: &LayoutJob,
|
job: &LayoutJob,
|
||||||
format_summary: &FormatSummary,
|
format_summary: &FormatSummary,
|
||||||
row: &mut Row,
|
row: &Row,
|
||||||
) -> RowVisuals {
|
) -> RowVisuals {
|
||||||
if row.glyphs.is_empty() {
|
if row.glyphs.is_empty() {
|
||||||
return Default::default();
|
return Default::default();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue