From fb7582bd7ae73c8cd6eaa1b49dc1f024d8b7fd8e Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Sat, 28 Sep 2019 22:16:12 -0400 Subject: [PATCH] Using Box::pin(...) instead of Pin::from(Box::new(...)) --- src/option/from_stream.rs | 4 ++-- src/result/from_stream.rs | 4 ++-- src/vec/from_stream.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/option/from_stream.rs b/src/option/from_stream.rs index 2d36ca1a..2c4c1391 100644 --- a/src/option/from_stream.rs +++ b/src/option/from_stream.rs @@ -19,7 +19,7 @@ where { let stream = stream.into_stream(); - Pin::from(Box::new(async move { + Box::pin(async move { pin_utils::pin_mut!(stream); // Using `scan` here because it is able to stop the stream early @@ -44,6 +44,6 @@ where } else { Some(out) } - })) + }) } } diff --git a/src/result/from_stream.rs b/src/result/from_stream.rs index 74cc5679..6033eb97 100644 --- a/src/result/from_stream.rs +++ b/src/result/from_stream.rs @@ -19,7 +19,7 @@ where { let stream = stream.into_stream(); - Pin::from(Box::new(async move { + Box::pin(async move { pin_utils::pin_mut!(stream); // Using `scan` here because it is able to stop the stream early @@ -43,6 +43,6 @@ where Some(err) => Err(err), None => Ok(out), } - })) + }) } } diff --git a/src/vec/from_stream.rs b/src/vec/from_stream.rs index 8848bda3..692c7fa0 100644 --- a/src/vec/from_stream.rs +++ b/src/vec/from_stream.rs @@ -12,12 +12,12 @@ impl FromStream for Vec { { let stream = stream.into_stream(); - Pin::from(Box::new(async move { + Box::pin(async move { pin_utils::pin_mut!(stream); let mut out = vec![]; out.stream_extend(stream).await; out - })) + }) } }