From ab7129cd45c7cddabf9629d5c4a1b2d533b33dfd Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Sat, 28 Sep 2019 22:11:13 -0400 Subject: [PATCH] FromStream for Vec in terms of Extend --- src/vec/from_stream.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/vec/from_stream.rs b/src/vec/from_stream.rs index ad82797d..8848bda3 100644 --- a/src/vec/from_stream.rs +++ b/src/vec/from_stream.rs @@ -1,7 +1,6 @@ use std::pin::Pin; -use crate::prelude::*; -use crate::stream::{FromStream, IntoStream}; +use crate::stream::{FromStream, IntoStream, Extend}; impl FromStream for Vec { #[inline] @@ -17,9 +16,7 @@ impl FromStream for Vec { pin_utils::pin_mut!(stream); let mut out = vec![]; - while let Some(item) = stream.next().await { - out.push(item); - } + out.stream_extend(stream).await; out })) }