From 8578a1362bc4b02fa28a2bf9ad1df1898e3629b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 27 Jun 2025 00:00:49 +0200 Subject: [PATCH] Fix `clippy` lints for Rust 1.88 :tada: --- examples/clock/src/main.rs | 2 +- examples/multi_window/src/main.rs | 2 +- examples/screenshot/src/main.rs | 2 +- examples/toast/src/main.rs | 11 +++++------ examples/tour/src/main.rs | 2 +- wgpu/src/window/compositor.rs | 2 +- widget/src/pane_grid.rs | 10 +++++----- winit/src/lib.rs | 2 +- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/examples/clock/src/main.rs b/examples/clock/src/main.rs index 428b1e63..a1050a76 100644 --- a/examples/clock/src/main.rs +++ b/examples/clock/src/main.rs @@ -166,7 +166,7 @@ impl canvas::Program for Clock { let y = radius * angle.0.sin(); frame.fill_text(canvas::Text { - content: format!("{}", hour), + content: format!("{hour}"), size: (radius / 5.0).into(), position: Point::new(x * 0.82, y * 0.82), color: palette.secondary.strong.text, diff --git a/examples/multi_window/src/main.rs b/examples/multi_window/src/main.rs index ff20c468..77be505b 100644 --- a/examples/multi_window/src/main.rs +++ b/examples/multi_window/src/main.rs @@ -161,7 +161,7 @@ impl Example { impl Window { fn new(count: usize) -> Self { Self { - title: format!("Window_{}", count), + title: format!("Window_{count}"), scale_input: "1.0".to_string(), current_scale: 1.0, theme: Theme::ALL[count % Theme::ALL.len()].clone(), diff --git a/examples/screenshot/src/main.rs b/examples/screenshot/src/main.rs index e4d0fc68..1f18e285 100644 --- a/examples/screenshot/src/main.rs +++ b/examples/screenshot/src/main.rs @@ -174,7 +174,7 @@ impl Example { |png_result| match png_result { Ok(path) => format!("Png saved as: {path:?}!"), Err(PngError(error)) => { - format!("Png could not be saved due to:\n{}", error) + format!("Png could not be saved due to:\n{error}") } }, ); diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index f1a8cfa5..b4e93a32 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -613,12 +613,11 @@ mod toast { &self.viewport, renderer, ) - .max( - cursor - .is_over(layout.bounds()) - .then_some(mouse::Interaction::Idle) - .unwrap_or_default(), - ) + .max(if cursor.is_over(layout.bounds()) { + mouse::Interaction::Idle + } else { + Default::default() + }) }) .max() .unwrap_or_default() diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index a08c96f3..984cf272 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -76,7 +76,7 @@ impl Tour { Screen::End => "End", }; - format!("{} - Iced", screen) + format!("{screen} - Iced") } fn update(&mut self, event: Message) { diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index 60cb33bb..c729ddd0 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -96,7 +96,7 @@ impl Compositor { let adapter = instance .request_adapter(&adapter_options) .await - .ok_or(Error::NoAdapterFound(format!("{:?}", adapter_options)))?; + .ok_or(Error::NoAdapterFound(format!("{adapter_options:?}")))?; log::info!("Selected: {:#?}", adapter.get_info()); diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs index 53206792..db60fabc 100644 --- a/widget/src/pane_grid.rs +++ b/widget/src/pane_grid.rs @@ -297,11 +297,11 @@ where } fn drag_enabled(&self) -> bool { - self.internal - .maximized() - .is_none() - .then(|| self.on_drag.is_some()) - .unwrap_or_default() + if self.internal.maximized().is_none() { + self.on_drag.is_some() + } else { + Default::default() + } } fn grid_interaction( diff --git a/winit/src/lib.rs b/winit/src/lib.rs index 5f1dfb22..c4e62863 100644 --- a/winit/src/lib.rs +++ b/winit/src/lib.rs @@ -810,7 +810,7 @@ async fn run_instance

( Err(error) => match error { // This is an unrecoverable error. compositor::SurfaceError::OutOfMemory => { - panic!("{:?}", error); + panic!("{error:?}"); } _ => { present_span.finish();