diff --git a/src/stream/extend.rs b/src/stream/extend.rs index 47dc828..27efd8b 100644 --- a/src/stream/extend.rs +++ b/src/stream/extend.rs @@ -33,7 +33,9 @@ pub trait Extend { fn stream_extend<'a, T: IntoStream + 'a>( &'a mut self, stream: T, - ) -> Pin + 'a>> where A: 'a; + ) -> Pin + 'a>> + where + A: 'a; } impl Extend<()> for () { diff --git a/src/string/extend.rs b/src/string/extend.rs index 71d14a3..feac1a4 100644 --- a/src/string/extend.rs +++ b/src/string/extend.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; use std::borrow::Cow; +use std::pin::Pin; use crate::prelude::*; use crate::stream::{Extend, IntoStream}; @@ -23,7 +23,10 @@ impl<'b> Extend<&'b char> for String { fn stream_extend<'a, S: IntoStream + 'a>( &'a mut self, stream: S, - ) -> Pin + 'a>> where 'b: 'a { + ) -> Pin + 'a>> + where + 'b: 'a, + { //TODO: Box::pin(stream.into_stream().copied()) unimplemented!() } @@ -33,7 +36,10 @@ impl<'b> Extend<&'b str> for String { fn stream_extend<'a, S: IntoStream + 'a>( &'a mut self, stream: S, - ) -> Pin + 'a>> where 'b: 'a { + ) -> Pin + 'a>> + where + 'b: 'a, + { //TODO: This can just be: stream.into_stream().for_each(move |s| self.push_str(s)) Box::pin(stream.into_stream().fold((), move |(), s| self.push_str(s))) } @@ -45,7 +51,11 @@ impl Extend for String { stream: S, ) -> Pin + 'a>> { //TODO: This can just be: stream.into_stream().for_each(move |s| self.push_str(&s)) - Box::pin(stream.into_stream().fold((), move |(), s| self.push_str(&s))) + Box::pin( + stream + .into_stream() + .fold((), move |(), s| self.push_str(&s)), + ) } } @@ -53,8 +63,15 @@ impl<'b> Extend> for String { fn stream_extend<'a, S: IntoStream> + 'a>( &'a mut self, stream: S, - ) -> Pin + 'a>> where 'b: 'a { + ) -> Pin + 'a>> + where + 'b: 'a, + { //TODO: This can just be: stream.into_stream().for_each(move |s| self.push_str(&s)) - Box::pin(stream.into_stream().fold((), move |(), s| self.push_str(&s))) + Box::pin( + stream + .into_stream() + .fold((), move |(), s| self.push_str(&s)), + ) } } diff --git a/src/string/from_stream.rs b/src/string/from_stream.rs index 7d3bc5b..276d13a 100644 --- a/src/string/from_stream.rs +++ b/src/string/from_stream.rs @@ -1,7 +1,7 @@ -use std::pin::Pin; use std::borrow::Cow; +use std::pin::Pin; -use crate::stream::{FromStream, IntoStream, Extend}; +use crate::stream::{Extend, FromStream, IntoStream}; impl FromStream for String { #[inline]