mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 14:50:03 -04:00
clippy fixes
This commit is contained in:
@@ -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
|
/// 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(
|
#[cfg(any(
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
@@ -688,7 +688,7 @@ fn get_wayland_display(window: &winit::window::Window) -> Option<*mut c_void> {
|
|||||||
target_os = "openbsd"
|
target_os = "openbsd"
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
return window.wayland_display();
|
return _window.wayland_display();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unreachable_code)]
|
#[allow(unreachable_code)]
|
||||||
|
|||||||
@@ -672,14 +672,14 @@ impl Plot {
|
|||||||
if axes.link_y {
|
if axes.link_y {
|
||||||
bounds.set_y(&linked_bounds);
|
bounds.set_y(&linked_bounds);
|
||||||
// Turn off auto bounds to keep it from overriding what we just set.
|
// 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.
|
// Allow double clicking to reset to automatic bounds.
|
||||||
if response.double_clicked_by(PointerButton::Primary) {
|
if response.double_clicked_by(PointerButton::Primary) {
|
||||||
auto_bounds = true.into()
|
auto_bounds = true.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set bounds automatically based on content.
|
// Set bounds automatically based on content.
|
||||||
@@ -726,7 +726,7 @@ impl Plot {
|
|||||||
if allow_drag && response.dragged_by(PointerButton::Primary) {
|
if allow_drag && response.dragged_by(PointerButton::Primary) {
|
||||||
response = response.on_hover_cursor(CursorIcon::Grabbing);
|
response = response.on_hover_cursor(CursorIcon::Grabbing);
|
||||||
transform.translate_bounds(-response.drag_delta());
|
transform.translate_bounds(-response.drag_delta());
|
||||||
auto_bounds = false.into()
|
auto_bounds = false.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zooming
|
// Zooming
|
||||||
@@ -767,9 +767,9 @@ impl Plot {
|
|||||||
};
|
};
|
||||||
if new_bounds.is_valid() {
|
if new_bounds.is_valid() {
|
||||||
*transform.bounds_mut() = new_bounds;
|
*transform.bounds_mut() = new_bounds;
|
||||||
auto_bounds = false.into()
|
auto_bounds = false.into();
|
||||||
} else {
|
} else {
|
||||||
auto_bounds = true.into()
|
auto_bounds = true.into();
|
||||||
}
|
}
|
||||||
// reset the boxed zoom state
|
// reset the boxed zoom state
|
||||||
last_click_pos_for_zoom = None;
|
last_click_pos_for_zoom = None;
|
||||||
@@ -786,14 +786,14 @@ impl Plot {
|
|||||||
};
|
};
|
||||||
if zoom_factor != Vec2::splat(1.0) {
|
if zoom_factor != Vec2::splat(1.0) {
|
||||||
transform.zoom(zoom_factor, hover_pos);
|
transform.zoom(zoom_factor, hover_pos);
|
||||||
auto_bounds = false.into()
|
auto_bounds = false.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if allow_scroll {
|
if allow_scroll {
|
||||||
let scroll_delta = ui.input().scroll_delta;
|
let scroll_delta = ui.input().scroll_delta;
|
||||||
if scroll_delta != Vec2::ZERO {
|
if scroll_delta != Vec2::ZERO {
|
||||||
transform.translate_bounds(-scroll_delta);
|
transform.translate_bounds(-scroll_delta);
|
||||||
auto_bounds = false.into()
|
auto_bounds = false.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,9 +186,12 @@ impl Color32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Construct a [`Color32`] from a hex RGB or RGBA string.
|
/// 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!("#202122"), Color32::from_rgb(0x20, 0x21, 0x22));
|
||||||
/// assert_eq!(hex_color!("#abcdef12"), Color32::from_rgba_unmultiplied(0xab, 0xcd, 0xef, 0x12));
|
/// assert_eq!(hex_color!("#abcdef12"), Color32::from_rgba_unmultiplied(0xab, 0xcd, 0xef, 0x12));
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
Reference in New Issue
Block a user