From 2f76a10a1d3617e414fb33c0c6cd5cb7782197ad Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 9 Jul 2022 18:03:59 +0200 Subject: Fix further `clippy` lints ... and explicitly annotate crates as well. --- lazy/src/component.rs | 4 ++-- lazy/src/lib.rs | 11 +++++++++++ lazy/src/pure/component.rs | 4 ++-- lazy/src/pure/responsive.rs | 2 +- lazy/src/responsive.rs | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) (limited to 'lazy/src') diff --git a/lazy/src/component.rs b/lazy/src/component.rs index 2c6b6ffb..847afbd8 100644 --- a/lazy/src/component.rs +++ b/lazy/src/component.rs @@ -38,7 +38,7 @@ pub trait Component { /// Produces the widgets of the [`Component`], which may trigger an [`Event`](Component::Event) /// on user interaction. - fn view(&mut self) -> Element; + fn view(&mut self) -> Element<'_, Self::Event, Renderer>; } /// Turns an implementor of [`Component`] into an [`Element`] that can be @@ -350,7 +350,7 @@ where layout: Layout<'_>, cursor_position: Point, ) { - self.with_overlay_maybe(|overlay| { + let _ = self.with_overlay_maybe(|overlay| { overlay.draw(renderer, theme, style, layout, cursor_position); }); } diff --git a/lazy/src/lib.rs b/lazy/src/lib.rs index 916f9458..7dc294cf 100644 --- a/lazy/src/lib.rs +++ b/lazy/src/lib.rs @@ -1,6 +1,17 @@ #![doc( html_logo_url = "https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg" )] +#![deny( + missing_debug_implementations, + unused_results, + clippy::extra_unused_lifetimes, + clippy::from_over_into, + clippy::needless_borrow, + clippy::new_without_default, + clippy::useless_conversion +)] +#![forbid(unsafe_code)] +#![allow(clippy::inherent_to_string, clippy::type_complexity)] #![cfg_attr(docsrs, feature(doc_cfg))] pub mod component; pub mod responsive; diff --git a/lazy/src/pure/component.rs b/lazy/src/pure/component.rs index 9b29b628..b8370263 100644 --- a/lazy/src/pure/component.rs +++ b/lazy/src/pure/component.rs @@ -43,7 +43,7 @@ pub trait Component { /// Produces the widgets of the [`Component`], which may trigger an [`Event`](Component::Event) /// on user interaction. - fn view(&self, state: &Self::State) -> Element; + fn view(&self, state: &Self::State) -> Element<'_, Self::Event, Renderer>; } /// Turns an implementor of [`Component`] into an [`Element`] that can be @@ -382,7 +382,7 @@ where layout: Layout<'_>, cursor_position: Point, ) { - self.with_overlay_maybe(|overlay| { + let _ = self.with_overlay_maybe(|overlay| { overlay.draw(renderer, theme, style, layout, cursor_position); }); } diff --git a/lazy/src/pure/responsive.rs b/lazy/src/pure/responsive.rs index 96b89fd6..d156f805 100644 --- a/lazy/src/pure/responsive.rs +++ b/lazy/src/pure/responsive.rs @@ -341,7 +341,7 @@ where layout: Layout<'_>, cursor_position: Point, ) { - self.with_overlay_maybe(|overlay| { + let _ = self.with_overlay_maybe(|overlay| { overlay.draw(renderer, theme, style, layout, cursor_position); }); } diff --git a/lazy/src/responsive.rs b/lazy/src/responsive.rs index 86c8db6b..d305689d 100644 --- a/lazy/src/responsive.rs +++ b/lazy/src/responsive.rs @@ -363,7 +363,7 @@ where layout: Layout<'_>, cursor_position: Point, ) { - self.with_overlay_maybe(|overlay| { + let _ = self.with_overlay_maybe(|overlay| { overlay.draw(renderer, theme, style, layout, cursor_position); }); } -- cgit From 2065a40f642589134142a740ff4198deaa4c378b Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 9 Jul 2022 18:42:41 +0200 Subject: Fix `clippy` lints for all crates and features ... and check those in CI as well! --- lazy/src/component.rs | 2 +- lazy/src/lib.rs | 6 +++++- lazy/src/pure/component.rs | 2 +- lazy/src/pure/responsive.rs | 2 +- lazy/src/responsive.rs | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'lazy/src') diff --git a/lazy/src/component.rs b/lazy/src/component.rs index 847afbd8..eac7e8ee 100644 --- a/lazy/src/component.rs +++ b/lazy/src/component.rs @@ -396,7 +396,7 @@ where &mut local_shell, ) }) - .unwrap_or_else(|| iced_native::event::Status::Ignored); + .unwrap_or(iced_native::event::Status::Ignored); local_shell.revalidate_layout(|| shell.invalidate_layout()); diff --git a/lazy/src/lib.rs b/lazy/src/lib.rs index 7dc294cf..aed11e9f 100644 --- a/lazy/src/lib.rs +++ b/lazy/src/lib.rs @@ -11,7 +11,11 @@ clippy::useless_conversion )] #![forbid(unsafe_code)] -#![allow(clippy::inherent_to_string, clippy::type_complexity)] +#![allow( + clippy::await_holding_refcell_ref, + clippy::inherent_to_string, + clippy::type_complexity +)] #![cfg_attr(docsrs, feature(doc_cfg))] pub mod component; pub mod responsive; diff --git a/lazy/src/pure/component.rs b/lazy/src/pure/component.rs index b8370263..b414a149 100644 --- a/lazy/src/pure/component.rs +++ b/lazy/src/pure/component.rs @@ -428,7 +428,7 @@ where &mut local_shell, ) }) - .unwrap_or_else(|| iced_native::event::Status::Ignored); + .unwrap_or(iced_native::event::Status::Ignored); local_shell.revalidate_layout(|| shell.invalidate_layout()); diff --git a/lazy/src/pure/responsive.rs b/lazy/src/pure/responsive.rs index d156f805..0964ebc8 100644 --- a/lazy/src/pure/responsive.rs +++ b/lazy/src/pure/responsive.rs @@ -383,6 +383,6 @@ where shell, ) }) - .unwrap_or_else(|| iced_native::event::Status::Ignored) + .unwrap_or(iced_native::event::Status::Ignored) } } diff --git a/lazy/src/responsive.rs b/lazy/src/responsive.rs index d305689d..4a3eb5c6 100644 --- a/lazy/src/responsive.rs +++ b/lazy/src/responsive.rs @@ -224,7 +224,7 @@ where where R: Deref, { - self.content.resolve(&mut self.state, renderer, f) + self.content.resolve(self.state, renderer, f) } } @@ -405,6 +405,6 @@ where shell, ) }) - .unwrap_or_else(|| iced_native::event::Status::Ignored) + .unwrap_or(iced_native::event::Status::Ignored) } } -- cgit