From e6092e81a42efe0bbaaad2e7ce475c25a379e672 Mon Sep 17 00:00:00 2001 From: 13r0ck Date: Fri, 27 Jan 2023 13:37:32 -0700 Subject: Fix: Clippy lint 'needless_lifetimes' --- graphics/src/renderer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'graphics/src') diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs index aabdf7fc..298cf4a1 100644 --- a/graphics/src/renderer.rs +++ b/graphics/src/renderer.rs @@ -53,9 +53,9 @@ where { type Theme = T; - fn layout<'a, Message>( + fn layout( &mut self, - element: &Element<'a, Message, Self>, + element: &Element<'_, Message, Self>, limits: &layout::Limits, ) -> layout::Node { let layout = element.as_widget().layout(self, limits); -- cgit From c7d8467c46e519b28f8f630061e7d55fb3cd3f8b Mon Sep 17 00:00:00 2001 From: sushigiri <117967760+sushigiri@users.noreply.github.com> Date: Mon, 6 Feb 2023 09:05:07 -0700 Subject: Accept FnOnce instead of Fn in canvas cache draw Use FnOnce in `draw` function signature instead of `Fn`, permitting the use of iterators and other one-time functions. --- graphics/src/widget/canvas/cache.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'graphics/src') diff --git a/graphics/src/widget/canvas/cache.rs b/graphics/src/widget/canvas/cache.rs index 49873ac9..52217bbb 100644 --- a/graphics/src/widget/canvas/cache.rs +++ b/graphics/src/widget/canvas/cache.rs @@ -49,7 +49,11 @@ impl Cache { /// Otherwise, the previously stored [`Geometry`] will be returned. The /// [`Cache`] is not cleared in this case. In other words, it will keep /// returning the stored [`Geometry`] if needed. - pub fn draw(&self, bounds: Size, draw_fn: impl Fn(&mut Frame)) -> Geometry { + pub fn draw( + &self, + bounds: Size, + draw_fn: impl FnOnce(&mut Frame), + ) -> Geometry { use std::ops::Deref; if let State::Filled { -- cgit