From b5cd9923f2e8f0d8d0b8145960e00084a27b6867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Mon, 13 Jan 2020 06:51:28 +0100 Subject: [PATCH] Remove `Clone` bound for `Element::map` --- native/src/element.rs | 6 ++---- web/src/element.rs | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/native/src/element.rs b/native/src/element.rs index fab73f77..ae47e893 100644 --- a/native/src/element.rs +++ b/native/src/element.rs @@ -171,7 +171,7 @@ where /// ``` pub fn map(self, f: F) -> Element<'a, B, Renderer> where - Message: 'static + Clone, + Message: 'static, Renderer: 'a, B: 'static, F: 'static + Fn(Message) -> B, @@ -269,7 +269,6 @@ impl<'a, A, B, Renderer> Map<'a, A, B, Renderer> { impl<'a, A, B, Renderer> Widget for Map<'a, A, B, Renderer> where - A: Clone, Renderer: crate::Renderer, { fn width(&self) -> Length { @@ -309,8 +308,7 @@ where ); original_messages - .iter() - .cloned() + .drain(..) .for_each(|message| messages.push((self.mapper)(message))); } diff --git a/web/src/element.rs b/web/src/element.rs index 85fa7c34..0315d7d6 100644 --- a/web/src/element.rs +++ b/web/src/element.rs @@ -38,8 +38,8 @@ impl<'a, Message> Element<'a, Message> { /// [`Element`]: struct.Element.html pub fn map(self, f: F) -> Element<'a, B> where - Message: 'static + Clone, - B: 'static + Clone, + Message: 'static, + B: 'static, F: 'static + Fn(Message) -> B, { Element { @@ -82,8 +82,8 @@ impl<'a, A, B> Map<'a, A, B> { impl<'a, A, B> Widget for Map<'a, A, B> where - A: 'static + Clone, - B: 'static + Clone, + A: 'static, + B: 'static, { fn node<'b>( &self,