clippy fixes

This commit is contained in:
Emil Ernerfeldt 2022-05-16 16:44:58 +02:00
parent 934fcd7e99
commit 810b609a80
3 changed files with 13 additions and 10 deletions

View file

@ -679,7 +679,7 @@ fn translate_cursor(cursor_icon: egui::CursorIcon) -> Option<winit::window::Curs
}
/// Returns a Wayland display handle if the target is running Wayland
fn get_wayland_display(window: &winit::window::Window) -> Option<*mut c_void> {
fn get_wayland_display(_window: &winit::window::Window) -> Option<*mut c_void> {
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
@ -688,7 +688,7 @@ fn get_wayland_display(window: &winit::window::Window) -> Option<*mut c_void> {
target_os = "openbsd"
))]
{
return window.wayland_display();
return _window.wayland_display();
}
#[allow(unreachable_code)]

View file

@ -672,14 +672,14 @@ impl Plot {
if axes.link_y {
bounds.set_y(&linked_bounds);
// Turn off auto bounds to keep it from overriding what we just set.
auto_bounds.y = false
auto_bounds.y = false;
}
}
};
// Allow double clicking to reset to automatic bounds.
if response.double_clicked_by(PointerButton::Primary) {
auto_bounds = true.into()
auto_bounds = true.into();
}
// Set bounds automatically based on content.
@ -726,7 +726,7 @@ impl Plot {
if allow_drag && response.dragged_by(PointerButton::Primary) {
response = response.on_hover_cursor(CursorIcon::Grabbing);
transform.translate_bounds(-response.drag_delta());
auto_bounds = false.into()
auto_bounds = false.into();
}
// Zooming
@ -767,9 +767,9 @@ impl Plot {
};
if new_bounds.is_valid() {
*transform.bounds_mut() = new_bounds;
auto_bounds = false.into()
auto_bounds = false.into();
} else {
auto_bounds = true.into()
auto_bounds = true.into();
}
// reset the boxed zoom state
last_click_pos_for_zoom = None;
@ -786,14 +786,14 @@ impl Plot {
};
if zoom_factor != Vec2::splat(1.0) {
transform.zoom(zoom_factor, hover_pos);
auto_bounds = false.into()
auto_bounds = false.into();
}
}
if allow_scroll {
let scroll_delta = ui.input().scroll_delta;
if scroll_delta != Vec2::ZERO {
transform.translate_bounds(-scroll_delta);
auto_bounds = false.into()
auto_bounds = false.into();
}
}
}

View file

@ -186,9 +186,12 @@ impl Color32 {
}
}
// ----------------------------------------------------------------------------
/// Construct a [`Color32`] from a hex RGB or RGBA string.
///
/// ```ignore
/// ```
/// # use epaint::{hex_color, Color32};
/// assert_eq!(hex_color!("#202122"), Color32::from_rgb(0x20, 0x21, 0x22));
/// assert_eq!(hex_color!("#abcdef12"), Color32::from_rgba_unmultiplied(0xab, 0xcd, 0xef, 0x12));
/// ```