Remove Clone bound for Element::map

This commit is contained in:
Héctor Ramón Jiménez 2020-01-13 06:51:28 +01:00
parent 4758e2ff75
commit b5cd9923f2
2 changed files with 6 additions and 8 deletions

View File

@ -171,7 +171,7 @@ where
/// ``` /// ```
pub fn map<F, B>(self, f: F) -> Element<'a, B, Renderer> pub fn map<F, B>(self, f: F) -> Element<'a, B, Renderer>
where where
Message: 'static + Clone, Message: 'static,
Renderer: 'a, Renderer: 'a,
B: 'static, B: 'static,
F: 'static + Fn(Message) -> B, 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<B, Renderer> for Map<'a, A, B, Renderer> impl<'a, A, B, Renderer> Widget<B, Renderer> for Map<'a, A, B, Renderer>
where where
A: Clone,
Renderer: crate::Renderer, Renderer: crate::Renderer,
{ {
fn width(&self) -> Length { fn width(&self) -> Length {
@ -309,8 +308,7 @@ where
); );
original_messages original_messages
.iter() .drain(..)
.cloned()
.for_each(|message| messages.push((self.mapper)(message))); .for_each(|message| messages.push((self.mapper)(message)));
} }

View File

@ -38,8 +38,8 @@ impl<'a, Message> Element<'a, Message> {
/// [`Element`]: struct.Element.html /// [`Element`]: struct.Element.html
pub fn map<F, B>(self, f: F) -> Element<'a, B> pub fn map<F, B>(self, f: F) -> Element<'a, B>
where where
Message: 'static + Clone, Message: 'static,
B: 'static + Clone, B: 'static,
F: 'static + Fn(Message) -> B, F: 'static + Fn(Message) -> B,
{ {
Element { Element {
@ -82,8 +82,8 @@ impl<'a, A, B> Map<'a, A, B> {
impl<'a, A, B> Widget<B> for Map<'a, A, B> impl<'a, A, B> Widget<B> for Map<'a, A, B>
where where
A: 'static + Clone, A: 'static,
B: 'static + Clone, B: 'static,
{ {
fn node<'b>( fn node<'b>(
&self, &self,