1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Apply nightly clippy suggestions/fixes (#7794)

* Reduce the diff for https://github.com/emilk/egui/pull/7793
This commit is contained in:
Emil Ernerfeldt
2025-12-19 18:43:58 +01:00
committed by GitHub
parent f1e0b2e565
commit 011c59c2ad
10 changed files with 183 additions and 197 deletions

View File

@@ -255,9 +255,7 @@ impl<'a> PanelSizer<'a> {
let side = self.panel.side;
let size_range = self.panel.size_range;
if is_resizing && pointer.is_some() {
let pointer = pointer.unwrap();
if is_resizing && let Some(pointer) = pointer {
match side {
PanelSide::Vertical(side) => {
self.size = (pointer.x - side.side_x(self.panel_rect)).abs();
@@ -811,9 +809,7 @@ impl Panel {
let resize_id = self.id.with("__resize");
let resize_response = ui.ctx().read_response(resize_id);
if resize_response.is_some() {
let resize_response = resize_response.unwrap();
if let Some(resize_response) = resize_response {
// NOTE(sharky98): The original code was initializing to
// false first, but it doesn't seem necessary.
let is_resizing = resize_response.dragged();

View File

@@ -631,8 +631,10 @@ impl InputState {
/// A positive Y-value indicates the content is being moved down, as when swiping down on a touch-screen or track-pad with natural scrolling.
#[inline(always)]
pub fn translation_delta(&self) -> Vec2 {
self.multi_touch()
.map_or(self.smooth_scroll_delta(), |touch| touch.translation_delta)
self.multi_touch().map_or_else(
|| self.smooth_scroll_delta(),
|touch| touch.translation_delta,
)
}
/// True if there is an active scroll action that might scroll more when using [`Self::smooth_scroll_delta`].