From c6554d990770b941b5003d6ef40af3f9dedcd052 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 19 Sep 2023 01:50:05 -0400 Subject: Chore: Apply clippy docs keyword quoting Add quotes a number of doc strings like `sRGB` --- runtime/src/window/screenshot.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/src/window/screenshot.rs b/runtime/src/window/screenshot.rs index c84286b6..21e04718 100644 --- a/runtime/src/window/screenshot.rs +++ b/runtime/src/window/screenshot.rs @@ -6,7 +6,7 @@ use std::sync::Arc; /// Data of a screenshot, captured with `window::screenshot()`. /// -/// The `bytes` of this screenshot will always be ordered as `RGBA` in the sRGB color space. +/// The `bytes` of this screenshot will always be ordered as `RGBA` in the `sRGB` color space. #[derive(Clone)] pub struct Screenshot { /// The bytes of the [`Screenshot`]. -- cgit From efd0ff6ded4e647e5fad0964555dbed541a075d7 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 19 Sep 2023 01:52:25 -0400 Subject: Chore: Apply some minor clippy fixes * Use `.elapsed()` for duration * Use direct iteration without calling `.iter()` and the like * order fields in the `Text` struct creation as declared --- runtime/src/debug/basic.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'runtime') diff --git a/runtime/src/debug/basic.rs b/runtime/src/debug/basic.rs index 32f725a1..4c994a2f 100644 --- a/runtime/src/debug/basic.rs +++ b/runtime/src/debug/basic.rs @@ -75,7 +75,7 @@ impl Debug { } pub fn startup_finished(&mut self) { - self.startup_duration = time::Instant::now() - self.startup_start; + self.startup_duration = self.startup_start.elapsed(); } pub fn update_started(&mut self) { @@ -83,8 +83,7 @@ impl Debug { } pub fn update_finished(&mut self) { - self.update_durations - .push(time::Instant::now() - self.update_start); + self.update_durations.push(self.update_start.elapsed()); } pub fn view_started(&mut self) { @@ -92,8 +91,7 @@ impl Debug { } pub fn view_finished(&mut self) { - self.view_durations - .push(time::Instant::now() - self.view_start); + self.view_durations.push(self.view_start.elapsed()); } pub fn layout_started(&mut self) { @@ -101,8 +99,7 @@ impl Debug { } pub fn layout_finished(&mut self) { - self.layout_durations - .push(time::Instant::now() - self.layout_start); + self.layout_durations.push(self.layout_start.elapsed()); } pub fn event_processing_started(&mut self) { @@ -110,8 +107,7 @@ impl Debug { } pub fn event_processing_finished(&mut self) { - self.event_durations - .push(time::Instant::now() - self.event_start); + self.event_durations.push(self.event_start.elapsed()); } pub fn draw_started(&mut self) { @@ -119,8 +115,7 @@ impl Debug { } pub fn draw_finished(&mut self) { - self.draw_durations - .push(time::Instant::now() - self.draw_start); + self.draw_durations.push(self.draw_start.elapsed()); } pub fn render_started(&mut self) { @@ -128,8 +123,7 @@ impl Debug { } pub fn render_finished(&mut self) { - self.render_durations - .push(time::Instant::now() - self.render_start); + self.render_durations.push(self.render_start.elapsed()); } pub fn log_message(&mut self, message: &Message) { -- cgit From 34f07b60273d6cfe13834af54cd0e24d34569387 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 20 Sep 2023 04:11:52 +0200 Subject: Fix `clippy::semicolon_if_nothing_returned` --- runtime/src/overlay/nested.rs | 2 +- runtime/src/program/state.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/src/overlay/nested.rs b/runtime/src/overlay/nested.rs index 21b6f7c1..062ccc72 100644 --- a/runtime/src/overlay/nested.rs +++ b/runtime/src/overlay/nested.rs @@ -164,7 +164,7 @@ where } } - recurse(&mut self.overlay, layout, renderer, operation) + recurse(&mut self.overlay, layout, renderer, operation); } /// Processes a runtime [`Event`]. diff --git a/runtime/src/program/state.rs b/runtime/src/program/state.rs index 9aa2d550..6f8f4063 100644 --- a/runtime/src/program/state.rs +++ b/runtime/src/program/state.rs @@ -200,7 +200,7 @@ where match operation.finish() { operation::Outcome::None => {} operation::Outcome::Some(message) => { - self.queued_messages.push(message) + self.queued_messages.push(message); } operation::Outcome::Chain(next) => { current_operation = Some(next); -- cgit From f137d71e8fb926e784680d56d1cfa6817c3710a1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 20 Sep 2023 16:40:03 +0200 Subject: Centralize `clippy` lints in `.cargo/config.toml` --- runtime/src/lib.rs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'runtime') diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index c3261cca..29e94d65 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -13,11 +13,6 @@ missing_debug_implementations, missing_docs, unused_results, - clippy::extra_unused_lifetimes, - clippy::from_over_into, - clippy::needless_borrow, - clippy::new_without_default, - clippy::useless_conversion, rustdoc::broken_intra_doc_links )] #![cfg_attr(docsrs, feature(doc_auto_cfg))] -- cgit From e0233ebc3ce4791d094c52eeef81cce78b9bc578 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 3 Aug 2023 10:19:28 -0700 Subject: Fix `Command::perform` to return a `Command` This seems like clearly the correct thing to do here. If the type bound on `Command` isn't specified, it makes no difference, since the generic is inferred in a way that works with either definition. But this is important if `Command` is aliased with a concrete type. --- runtime/src/command.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/src/command.rs b/runtime/src/command.rs index cd4c51ff..b74097bd 100644 --- a/runtime/src/command.rs +++ b/runtime/src/command.rs @@ -40,9 +40,9 @@ impl Command { /// Creates a [`Command`] that performs the action of the given future. pub fn perform( - future: impl Future + 'static + MaybeSend, - f: impl FnOnce(T) -> A + 'static + MaybeSend, - ) -> Command { + future: impl Future + 'static + MaybeSend, + f: impl FnOnce(A) -> T + 'static + MaybeSend, + ) -> Command { use iced_futures::futures::FutureExt; Command::single(Action::Future(Box::pin(future.map(f)))) -- cgit