Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed May 21, 2022
1 parent 934fcd7 commit 810b609
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)]
Expand Down
14 changes: 7 additions & 7 deletions egui/src/widgets/plot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion epaint/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
/// ```
Expand Down

0 comments on commit 810b609

Please sign in to comment.