Repository: alexcrichton/futures-rs
Pull request #568 (2017-08-31 14:29:14)

Add a `prelude` module to the crate
The intention here is that almost all modules need at least a subset of these
reexports and they shouldn't otherwise cause problems to import extra items.
Similar to the standard library prelude, only not automatically included!

alexcrichton: I've updated the documentation of the `Future` trait, but if we'd like to pursue this then I'd like to update the `Stream`/`Sink` traits as well in addition to the tests.

Patch:
diff --git a/src/future/mod.rs b/src/future/mod.rs
index 00a87855..0beabd80 100644
--- a/src/future/mod.rs
+++ b/src/future/mod.rs
@@ -314,7 +314,8 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future::{BoxFuture, result};
     ///
     /// let a: BoxFuture<i32, i32> = result(Ok(1)).boxed();
     /// ```
@@ -348,9 +349,10 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let future = ok::<u32, u32>(1);
+    /// let future = future::ok::<u32, u32>(1);
     /// let new_future = future.map(|x| x + 3);
     /// assert_eq!(new_future.wait(), Ok(4));
     /// ```
@@ -358,9 +360,10 @@ pub trait Future {
     /// Calling `map` on an errored `Future` has no effect:
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let future = err::<u32, u32>(1);
+    /// let future = future::err::<u32, u32>(1);
     /// let new_future = future.map(|x| x + 3);
     /// assert_eq!(new_future.wait(), Err(1));
     /// ```
@@ -428,9 +431,10 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let future_with_err_u8 = err::<(), u8>(1);
+    /// let future_with_err_u8 = future::err::<(), u8>(1);
     /// let future_with_err_u32 = future_with_err_u8.from_err::<u32>();
     /// ```
     fn from_err<E:From<Self::Error>>(self) -> FromErr<Self, E>
@@ -461,18 +465,19 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let future_of_1 = ok::<u32, u32>(1);
+    /// let future_of_1 = future::ok::<u32, u32>(1);
     /// let future_of_4 = future_of_1.then(|x| {
     ///     x.map(|y| y + 3)
     /// });
     ///
-    /// let future_of_err_1 = err::<u32, u32>(1);
+    /// let future_of_err_1 = future::err::<u32, u32>(1);
     /// let future_of_4 = future_of_err_1.then(|x| {
     ///     match x {
     ///         Ok(_) => panic!("expected an error"),
-    ///         Err(y) => ok::<u32, u32>(y + 3),
+    ///         Err(y) => future::ok::<u32, u32>(y + 3),
     ///     }
     /// });
     /// ```
@@ -504,14 +509,15 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future::{self, FutureResult};
     ///
-    /// let future_of_1 = ok::<u32, u32>(1);
+    /// let future_of_1 = future::ok::<u32, u32>(1);
     /// let future_of_4 = future_of_1.and_then(|x| {
     ///     Ok(x + 3)
     /// });
     ///
-    /// let future_of_err_1 = err::<u32, u32>(1);
+    /// let future_of_err_1 = future::err::<u32, u32>(1);
     /// future_of_err_1.and_then(|_| -> FutureResult<u32, u32> {
     ///     panic!("should not be called in case of an error");
     /// });
@@ -544,14 +550,15 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future::{self, FutureResult};
     ///
-    /// let future_of_err_1 = err::<u32, u32>(1);
+    /// let future_of_err_1 = future::err::<u32, u32>(1);
     /// let future_of_4 = future_of_err_1.or_else(|x| -> Result<u32, u32> {
     ///     Ok(x + 3)
     /// });
     ///
-    /// let future_of_1 = ok::<u32, u32>(1);
+    /// let future_of_1 = future::ok::<u32, u32>(1);
     /// future_of_1.or_else(|_| -> FutureResult<u32, u32> {
     ///     panic!("should not be called in case of success");
     /// });
@@ -577,18 +584,19 @@ pub trait Future {
     /// # Examples
     ///
     /// ```no_run
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     /// use std::thread;
     /// use std::time;
     ///
-    /// let future1 = lazy(|| {
+    /// let future1 = future::lazy(|| {
     ///     thread::sleep(time::Duration::from_secs(5));
-    ///     ok::<char, ()>('a')
+    ///     future::ok::<char, ()>('a')
     /// });
     ///
-    /// let future2 = lazy(|| {
+    /// let future2 = future::lazy(|| {
     ///     thread::sleep(time::Duration::from_secs(3));
-    ///     ok::<char, ()>('b')
+    ///     future::ok::<char, ()>('b')
     /// });
     ///
     /// let (value, last_future) = future1.select(future2).wait().ok().unwrap();
@@ -599,17 +607,18 @@ pub trait Future {
     /// A poor-man's `join` implemented on top of `select`:
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// fn join<A>(a: A, b: A) -> BoxFuture<(u32, u32), u32>
-    ///     where A: Future<Item = u32, Error = u32> + Send + 'static,
+    /// fn join<A>(a: A, b: A) -> Box<Future<Item=(u32, u32), Error=u32>>
+    ///     where A: Future<Item = u32, Error = u32> + 'static,
     /// {
-    ///     a.select(b).then(|res| {
+    ///     Box::new(a.select(b).then(|res| -> Box<Future<Item=_, Error=_>> {
     ///         match res {
-    ///             Ok((a, b)) => b.map(move |b| (a, b)).boxed(),
-    ///             Err((a, _)) => err(a).boxed(),
+    ///             Ok((a, b)) => Box::new(b.map(move |b| (a, b))),
+    ///             Err((a, _)) => Box::new(future::err(a)),
     ///         }
-    ///     }).boxed()
+    ///     }))
     /// }
     /// ```
     fn select<B>(self, other: B) -> Select<Self, B::Future>
@@ -638,23 +647,24 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future::{self, Either};
     ///
     /// // A poor-man's join implemented on top of select2
     ///
-    /// fn join<A, B, E>(a: A, b: B) -> BoxFuture<(A::Item, B::Item), E>
-    ///     where A: Future<Error = E> + Send + 'static,
-    ///           B: Future<Error = E> + Send + 'static,
-    ///           A::Item: Send, B::Item: Send, E: Send + 'static,
+    /// fn join<A, B, E>(a: A, b: B) -> Box<Future<Item=(A::Item, B::Item), Error=E>>
+    ///     where A: Future<Error = E> + 'static,
+    ///           B: Future<Error = E> + 'static,
+    ///           E: 'static,
     /// {
-    ///     a.select2(b).then(|res| {
+    ///     Box::new(a.select2(b).then(|res| -> Box<Future<Item=_, Error=_>> {
     ///         match res {
-    ///             Ok(Either::A((x, b))) => b.map(move |y| (x, y)).boxed(),
-    ///             Ok(Either::B((y, a))) => a.map(move |x| (x, y)).boxed(),
-    ///             Err(Either::A((e, _))) => err(e).boxed(),
-    ///             Err(Either::B((e, _))) => err(e).boxed(),
+    ///             Ok(Either::A((x, b))) => Box::new(b.map(move |y| (x, y))),
+    ///             Ok(Either::B((y, a))) => Box::new(a.map(move |x| (x, y))),
+    ///             Err(Either::A((e, _))) => Box::new(future::err(e)),
+    ///             Err(Either::B((e, _))) => Box::new(future::err(e)),
     ///         }
-    ///     }).boxed()
+    ///     }))
     /// }
     /// ```
     fn select2<B>(self, other: B) -> Select2<Self, B::Future>
@@ -679,10 +689,11 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let a = ok::<u32, u32>(1);
-    /// let b = ok::<u32, u32>(2);
+    /// let a = future::ok::<u32, u32>(1);
+    /// let b = future::ok::<u32, u32>(2);
     /// let pair = a.join(b);
     ///
     /// assert_eq!(pair.wait(), Ok((1, 2)));
@@ -692,10 +703,11 @@ pub trait Future {
     /// `Future` will be errored:
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let a = ok::<u32, u32>(1);
-    /// let b = err::<u32, u32>(2);
+    /// let a = future::ok::<u32, u32>(1);
+    /// let b = future::err::<u32, u32>(2);
     /// let pair = a.join(b);
     ///
     /// assert_eq!(pair.wait(), Err(2));
@@ -749,15 +761,15 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::{Stream, Async};
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let future = ok::<_, bool>(17);
+    /// let future = future::ok::<_, bool>(17);
     /// let mut stream = future.into_stream();
     /// assert_eq!(Ok(Async::Ready(Some(17))), stream.poll());
     /// assert_eq!(Ok(Async::Ready(None)), stream.poll());
     ///
-    /// let future = err::<bool, _>(19);
+    /// let future = future::err::<bool, _>(19);
     /// let mut stream = future.into_stream();
     /// assert_eq!(Err(19), stream.poll());
     /// assert_eq!(Ok(Async::Ready(None)), stream.poll());
@@ -785,9 +797,10 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let nested_future = ok::<_, u32>(ok::<u32, u32>(1));
+    /// let nested_future = future::ok::<_, u32>(future::ok::<u32, u32>(1));
     /// let future = nested_future.flatten();
     /// assert_eq!(future.wait(), Ok(1));
     /// ```
@@ -796,9 +809,10 @@ pub trait Future {
     /// errored, will result in an errored `Future`:
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let nested_future = ok::<_, u32>(err::<u32, u32>(1));
+    /// let nested_future = future::ok::<_, u32>(future::err::<u32, u32>(1));
     /// let future = nested_future.flatten();
     /// assert_eq!(future.wait(), Err(1));
     /// ```
@@ -827,17 +841,18 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::stream::{self, Stream};
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
+    /// use futures::stream;
     ///
-    /// let stream_items = vec![Ok(17), Err(true), Ok(19)];
-    /// let future_of_a_stream = ok::<_, bool>(stream::iter(stream_items));
+    /// let stream_items = vec![17, 18, 19];
+    /// let future_of_a_stream = future::ok::<_, bool>(stream::iter_ok(stream_items));
     ///
     /// let stream = future_of_a_stream.flatten_stream();
     ///
     /// let mut iter = stream.wait();
     /// assert_eq!(Ok(17), iter.next().unwrap());
-    /// assert_eq!(Err(true), iter.next().unwrap());
+    /// assert_eq!(Ok(18), iter.next().unwrap());
     /// assert_eq!(Ok(19), iter.next().unwrap());
     /// assert_eq!(None, iter.next());
     /// ```
@@ -867,17 +882,17 @@ pub trait Future {
     /// # Examples
     ///
     /// ```rust
-    /// use futures::Async;
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let mut future = ok::<i32, u32>(2);
+    /// let mut future = future::ok::<i32, u32>(2);
     /// assert_eq!(future.poll(), Ok(Async::Ready(2)));
     ///
     /// // Normally, a call such as this would panic:
     /// //future.poll();
     ///
     /// // This, however, is guaranteed to not panic
-    /// let mut future = ok::<i32, u32>(2).fuse();
+    /// let mut future = future::ok::<i32, u32>(2).fuse();
     /// assert_eq!(future.poll(), Ok(Async::Ready(2)));
     /// assert_eq!(future.poll(), Ok(Async::NotReady));
     /// ```
@@ -897,9 +912,10 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let future = ok::<u32, u32>(1);
+    /// let future = future::ok::<u32, u32>(1);
     /// let new_future = future.inspect(|&x| println!("about to resolve: {}", x));
     /// assert_eq!(new_future.wait(), Ok(1));
     /// ```
@@ -929,14 +945,15 @@ pub trait Future {
     /// # Examples
     ///
     /// ```rust
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future::{self, FutureResult};
     ///
-    /// let mut future = ok::<i32, u32>(2);
+    /// let mut future = future::ok::<i32, u32>(2);
     /// assert!(future.catch_unwind().wait().is_ok());
     ///
-    /// let mut future = lazy(|| -> FutureResult<i32, u32> {
+    /// let mut future = future::lazy(|| -> FutureResult<i32, u32> {
     ///     panic!();
-    ///     ok::<i32, u32>(2)
+    ///     future::ok::<i32, u32>(2)
     /// });
     /// assert!(future.catch_unwind().wait().is_err());
     /// ```
@@ -965,9 +982,10 @@ pub trait Future {
     /// # Examples
     ///
     /// ```
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let future = ok::<_, bool>(6);
+    /// let future = future::ok::<_, bool>(6);
     /// let shared1 = future.shared();
     /// let shared2 = shared1.clone();
     /// assert_eq!(6, *shared1.wait().unwrap());
@@ -976,9 +994,10 @@ pub trait Future {
     ///
     /// ```
     /// use std::thread;
-    /// use futures::future::*;
+    /// use futures::prelude::*;
+    /// use futures::future;
     ///
-    /// let future = ok::<_, bool>(6);
+    /// let future = future::ok::<_, bool>(6);
     /// let shared1 = future.shared();
     /// let shared2 = shared1.clone();
     /// let join_handle = thread::spawn(move || {
diff --git a/src/lib.rs b/src/lib.rs
index d501939d..ac27d3bc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -37,7 +37,8 @@
 //!
 //! use std::io;
 //! use std::time::Duration;
-//! use futures::future::{Future, Map};
+//! use futures::prelude::*;
+//! use futures::future::Map;
 //!
 //! // A future is actually a trait implementation, so we can generically take a
 //! // future of any integer and return back a future that will resolve to that
@@ -242,3 +243,23 @@ if_std! {
     #[cfg(feature = "with-deprecated")]
     pub use future::{SelectAll, SelectAllNext, Collect, SelectOk};
 }
+
+/// A "prelude" for crates using the `futures` crate.
+///
+/// This prelude is similar to the standard library's prelude in that you'll
+/// almost always want to import its entire contents, but unlike the standard
+/// library's prelude you'll have to do so manually. An example of using this is:
+///
+/// ```
+/// use futures::prelude::*;
+/// ```
+///
+/// We may add items to this over time as they become ubiquitous as well, but
+/// otherwise this should help cut down on futures-related imports when you're
+/// working with the `futures` crate!
+pub mod prelude {
+    #[doc(no_inline)]
+    pub use {Future, Stream, Sink, Async, AsyncSink, Poll, StartSend};
+    #[doc(no_inline)]
+    pub use IntoFuture;
+}
diff --git a/src/sink/mod.rs b/src/sink/mod.rs
index 37e8cf73..772ae21c 100644
--- a/src/sink/mod.rs
+++ b/src/sink/mod.rs
@@ -335,10 +335,10 @@ pub trait Sink {
     /// function
     ///
     /// ```
-    /// use futures::{Sink,Future,Stream};
+    /// use futures::prelude::*;
     /// use futures::stream;
     /// use futures::sync::mpsc;
-    /// 
+    ///
     /// let (tx, rx) = mpsc::channel::<i32>(5);
     ///
     /// let tx = tx.with_flat_map(|x| {
diff --git a/src/stream/mod.rs b/src/stream/mod.rs
index ec3a24b4..d1f85bec 100755
--- a/src/stream/mod.rs
+++ b/src/stream/mod.rs
@@ -301,7 +301,7 @@ pub trait Stream {
     /// # Examples
     ///
     /// ```
-    /// use futures::Stream;
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (_tx, rx) = mpsc::channel::<i32>(1);
@@ -327,7 +327,7 @@ pub trait Stream {
     /// # Examples
     ///
     /// ```
-    /// use futures::Stream;
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (_tx, rx) = mpsc::channel::<i32>(1);
@@ -357,7 +357,7 @@ pub trait Stream {
     /// # Examples
     ///
     /// ```
-    /// use futures::Stream;
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (_tx, rx) = mpsc::channel::<i32>(1);
@@ -387,7 +387,7 @@ pub trait Stream {
     /// # Examples
     ///
     /// ```
-    /// use futures::Stream;
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (_tx, rx) = mpsc::channel::<i32>(1);
@@ -426,7 +426,7 @@ pub trait Stream {
     /// # Examples
     ///
     /// ```
-    /// use futures::Stream;
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (_tx, rx) = mpsc::channel::<i32>(1);
@@ -469,7 +469,7 @@ pub trait Stream {
     /// # Examples
     ///
     /// ```
-    /// use futures::stream::*;
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (_tx, rx) = mpsc::channel::<i32>(1);
@@ -535,7 +535,7 @@ pub trait Stream {
     /// ```
     /// use std::thread;
     ///
-    /// use futures::{Stream, Future, Sink};
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (mut tx, rx) = mpsc::channel(1);
@@ -572,7 +572,7 @@ pub trait Stream {
     /// ```
     /// use std::thread;
     ///
-    /// use futures::{Future, Sink, Stream};
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (mut tx, rx) = mpsc::channel(1);
@@ -605,7 +605,7 @@ pub trait Stream {
     /// ```
     /// use std::thread;
     ///
-    /// use futures::{Future, Sink, Stream};
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (mut tx, rx) = mpsc::channel(1);
@@ -647,11 +647,12 @@ pub trait Stream {
     /// # Examples
     ///
     /// ```
-    /// use futures::stream::{self, Stream};
-    /// use futures::future::{ok, Future};
+    /// use futures::prelude::*;
+    /// use futures::stream;
+    /// use futures::future;
     ///
     /// let number_stream = stream::iter::<_, _, ()>((0..6).map(Ok));
-    /// let sum = number_stream.fold(0, |acc, x| ok(acc + x));
+    /// let sum = number_stream.fold(0, |acc, x| future::ok(acc + x));
     /// assert_eq!(sum.wait(), Ok(15));
     /// ```
     fn fold<F, T, Fut>(self, init: T, f: F) -> Fold<Self, F, Fut, T>
@@ -673,7 +674,7 @@ pub trait Stream {
     /// ```
     /// use std::thread;
     ///
-    /// use futures::{Future, Stream, Poll, Sink};
+    /// use futures::prelude::*;
     /// use futures::sync::mpsc;
     ///
     /// let (tx1, rx1) = mpsc::channel::<i32>(1);
@@ -827,16 +828,17 @@ pub trait Stream {
     /// ownership of the original stream.
     ///
     /// ```
-    /// use futures::future::{ok, Future};
-    /// use futures::stream::{self, Stream};
+    /// use futures::prelude::*;
+    /// use futures::stream;
+    /// use futures::future;
     ///
-    /// let mut stream = stream::iter::<_, _, ()>((1..5).map(Ok));
+    /// let mut stream = stream::iter_ok::<_, ()>(1..5);
     ///
-    /// let sum = stream.by_ref().take(2).fold(0, |a, b| ok(a + b)).wait();
+    /// let sum = stream.by_ref().take(2).fold(0, |a, b| future::ok(a + b)).wait();
     /// assert_eq!(sum, Ok(3));
     ///
     /// // You can use the stream again
-    /// let sum = stream.take(2).fold(0, |a, b| ok(a + b)).wait();
+    /// let sum = stream.take(2).fold(0, |a, b| future::ok(a + b)).wait();
     /// assert_eq!(sum, Ok(7));
     /// ```
     fn by_ref(&mut self) -> &mut Self
@@ -866,11 +868,10 @@ pub trait Stream {
     /// # Examples
     ///
     /// ```rust
+    /// use futures::prelude::*;
     /// use futures::stream;
-    /// use futures::stream::Stream;
     ///
-    /// let stream = stream::iter::<_, Option<i32>, bool>(vec![
-    ///     Some(10), None, Some(11)].into_iter().map(Ok));
+    /// let stream = stream::iter_ok::<_, bool>(vec![Some(10), None, Some(11)]);
     /// // panic on second element
     /// let stream_panicking = stream.map(|o| o.unwrap());
     /// let mut iter = stream_panicking.catch_unwind().wait();
@@ -960,8 +961,8 @@ pub trait Stream {
     /// first stream reaches the end, emits the elements from the second stream.
     ///
     /// ```rust
+    /// use futures::prelude::*;
     /// use futures::stream;
-    /// use futures::stream::Stream;
     ///
     /// let stream1 = stream::iter(vec![Ok(10), Err(false)]);
     /// let stream2 = stream::iter(vec![Err(true), Ok(20)]);


Test patch:
diff --git a/tests/bilock.rs b/tests/bilock.rs
index bb79aa29..78d87363 100644
--- a/tests/bilock.rs
+++ b/tests/bilock.rs
@@ -2,10 +2,10 @@ extern crate futures;
 
 use std::thread;
 
-use futures::{Async, Poll};
+use futures::prelude::*;
 use futures::executor;
-use futures::stream::{self, Stream};
-use futures::future::{self, Future};
+use futures::stream;
+use futures::future;
 use futures::sync::BiLock;
 
 mod support;
diff --git a/tests/buffer_unordered.rs b/tests/buffer_unordered.rs
index e47a0d8d..005bbd98 100644
--- a/tests/buffer_unordered.rs
+++ b/tests/buffer_unordered.rs
@@ -3,7 +3,7 @@ extern crate futures;
 use std::sync::mpsc as std_mpsc;
 use std::thread;
 
-use futures::{Future, Stream, Sink};
+use futures::prelude::*;
 use futures::sync::oneshot;
 use futures::sync::mpsc;
 
diff --git a/tests/channel.rs b/tests/channel.rs
index 214c1551..58c611b5 100644
--- a/tests/channel.rs
+++ b/tests/channel.rs
@@ -2,7 +2,7 @@ extern crate futures;
 
 use std::sync::atomic::*;
 
-use futures::{Future, Stream, Sink};
+use futures::prelude::*;
 use futures::future::result;
 use futures::sync::mpsc;
 
diff --git a/tests/eager_drop.rs b/tests/eager_drop.rs
index 94f30d2b..79f94d5d 100644
--- a/tests/eager_drop.rs
+++ b/tests/eager_drop.rs
@@ -2,9 +2,9 @@ extern crate futures;
 
 use std::sync::mpsc::channel;
 
-use futures::Poll;
-use futures::future::*;
+use futures::prelude::*;
 use futures::sync::oneshot;
+use futures::future::{err, ok};
 
 mod support;
 use support::*;
diff --git a/tests/eventual.rs b/tests/eventual.rs
index 5bf3680d..fc484aaa 100644
--- a/tests/eventual.rs
+++ b/tests/eventual.rs
@@ -6,7 +6,7 @@ use support::*;
 use std::sync::mpsc;
 use std::thread;
 
-use futures::Future;
+use futures::prelude::*;
 use futures::future::{ok, err};
 use futures::sync::oneshot;
 
diff --git a/tests/fuse.rs b/tests/fuse.rs
index 670e3f0c..a1e6cee2 100644
--- a/tests/fuse.rs
+++ b/tests/fuse.rs
@@ -1,6 +1,7 @@
 extern crate futures;
 
-use futures::future::{ok, Future};
+use futures::prelude::*;
+use futures::future::ok;
 use futures::executor;
 
 mod support;
diff --git a/tests/future_flatten_stream.rs b/tests/future_flatten_stream.rs
index f9c97a8f..442d381f 100644
--- a/tests/future_flatten_stream.rs
+++ b/tests/future_flatten_stream.rs
@@ -3,7 +3,7 @@ extern crate futures;
 
 use core::marker;
 
-use futures::{Stream, Future, Poll};
+use futures::prelude::*;
 use futures::future::{ok, err};
 use futures::stream;
 
diff --git a/tests/futures_ordered.rs b/tests/futures_ordered.rs
index 7cd78e25..dad92095 100644
--- a/tests/futures_ordered.rs
+++ b/tests/futures_ordered.rs
@@ -4,7 +4,7 @@ use std::any::Any;
 
 use futures::sync::oneshot;
 use futures::stream::futures_ordered;
-use futures::Future;
+use futures::prelude::*;
 
 mod support;
 
diff --git a/tests/futures_unordered.rs b/tests/futures_unordered.rs
index f5f00ba1..9f1fb95c 100644
--- a/tests/futures_unordered.rs
+++ b/tests/futures_unordered.rs
@@ -4,7 +4,7 @@ use std::any::Any;
 
 use futures::sync::oneshot;
 use futures::stream::futures_unordered;
-use futures::Future;
+use futures::prelude::*;
 
 mod support;
 
diff --git a/tests/inspect.rs b/tests/inspect.rs
index 5c45535d..c16372ed 100644
--- a/tests/inspect.rs
+++ b/tests/inspect.rs
@@ -1,6 +1,7 @@
 extern crate futures;
 
-use futures::future::{ok, err, Future};
+use futures::prelude::*;
+use futures::future::{ok, err};
 
 #[test]
 fn smoke() {
diff --git a/tests/mpsc-close.rs b/tests/mpsc-close.rs
index 50ad4d45..253e0157 100644
--- a/tests/mpsc-close.rs
+++ b/tests/mpsc-close.rs
@@ -2,7 +2,7 @@ extern crate futures;
 
 use std::thread;
 
-use futures::{Sink, Stream, Future};
+use futures::prelude::*;
 use futures::sync::mpsc::*;
 
 #[test]
diff --git a/tests/mpsc.rs b/tests/mpsc.rs
index ae062349..ecd84109 100644
--- a/tests/mpsc.rs
+++ b/tests/mpsc.rs
@@ -2,7 +2,7 @@
 
 extern crate futures;
 
-use futures::{Future, Stream, Sink, Async, AsyncSink};
+use futures::prelude::*;
 use futures::future::{lazy, ok};
 use futures::stream::unfold;
 use futures::sync::mpsc;
diff --git a/tests/oneshot.rs b/tests/oneshot.rs
index 85e5b593..fabc4f06 100644
--- a/tests/oneshot.rs
+++ b/tests/oneshot.rs
@@ -3,7 +3,7 @@ extern crate futures;
 use std::sync::mpsc;
 use std::thread;
 
-use futures::{Future, Poll};
+use futures::prelude::*;
 use futures::future::{lazy, ok};
 use futures::sync::oneshot::*;
 
diff --git a/tests/ready_queue.rs b/tests/ready_queue.rs
index e90c7a5a..b0dc2375 100644
--- a/tests/ready_queue.rs
+++ b/tests/ready_queue.rs
@@ -2,7 +2,7 @@ extern crate futures;
 
 use std::panic::{self, AssertUnwindSafe};
 
-use futures::{Future, Stream, Poll};
+use futures::prelude::*;
 use futures::Async::*;
 use futures::future;
 use futures::stream::FuturesUnordered;
diff --git a/tests/recurse.rs b/tests/recurse.rs
index aa1b071f..4eb024ac 100644
--- a/tests/recurse.rs
+++ b/tests/recurse.rs
@@ -2,7 +2,8 @@ extern crate futures;
 
 use std::sync::mpsc::channel;
 
-use futures::future::{ok, Future};
+use futures::future::ok;
+use futures::prelude::*;
 
 #[test]
 fn lots() {
diff --git a/tests/select_all.rs b/tests/select_all.rs
index a7b52127..7780aa30 100644
--- a/tests/select_all.rs
+++ b/tests/select_all.rs
@@ -1,6 +1,7 @@
 extern crate futures;
 
-use futures::future::*;
+use futures::prelude::*;
+use futures::future::{ok, select_all, err};
 
 #[test]
 fn smoke() {
diff --git a/tests/shared.rs b/tests/shared.rs
index 0516177d..99d2b381 100644
--- a/tests/shared.rs
+++ b/tests/shared.rs
@@ -7,7 +7,7 @@ use std::rc::Rc;
 use std::thread;
 
 use futures::sync::oneshot;
-use futures::Future;
+use futures::prelude::*;
 use futures::future;
 
 fn send_shared_oneshot_and_wait_on_multiple_threads(threads_number: u32) {
diff --git a/tests/sink.rs b/tests/sink.rs
index e0ae171e..aa0d57ef 100644
--- a/tests/sink.rs
+++ b/tests/sink.rs
@@ -6,7 +6,7 @@ use std::rc::Rc;
 use std::cell::{Cell, RefCell};
 use std::sync::atomic::{Ordering, AtomicBool};
 
-use futures::{Poll, Async, Future, AsyncSink, StartSend};
+use futures::prelude::*;
 use futures::future::ok;
 use futures::stream;
 use futures::sync::{oneshot, mpsc};
diff --git a/tests/split.rs b/tests/split.rs
index 81695c51..7a0667f1 100644
--- a/tests/split.rs
+++ b/tests/split.rs
@@ -1,6 +1,6 @@
 extern crate futures;
 
-use futures::{Future, StartSend, Sink, Stream, Poll};
+use futures::prelude::*;
 use futures::stream::iter_ok;
 
 struct Join<T, U>(T, U);
diff --git a/tests/stream.rs b/tests/stream.rs
index 51e3aa98..b0e8a361 100644
--- a/tests/stream.rs
+++ b/tests/stream.rs
@@ -1,7 +1,7 @@
 #[macro_use]
 extern crate futures;
 
-use futures::{Async, Future, Poll, Sink, Stream};
+use futures::prelude::*;
 use futures::executor;
 use futures::future::{err, ok};
 use futures::stream::{empty, iter_ok, poll_fn, Peekable};
diff --git a/tests/stream_catch_unwind.rs b/tests/stream_catch_unwind.rs
index 7278fe98..a06748d0 100644
--- a/tests/stream_catch_unwind.rs
+++ b/tests/stream_catch_unwind.rs
@@ -1,7 +1,7 @@
 extern crate futures;
 
 use futures::stream;
-use futures::stream::Stream;
+use futures::prelude::*;
 
 #[test]
 fn panic_in_the_middle_of_the_stream() {
diff --git a/tests/unfold.rs b/tests/unfold.rs
index 47ef3503..1669a18a 100644
--- a/tests/unfold.rs
+++ b/tests/unfold.rs
@@ -2,7 +2,7 @@ extern crate futures;
 
 mod support;
 
-use futures::*;
+use futures::stream;
 
 use support::*;
 
diff --git a/tests/unsync-oneshot.rs b/tests/unsync-oneshot.rs
index 565c3953..76d752e6 100644
--- a/tests/unsync-oneshot.rs
+++ b/tests/unsync-oneshot.rs
@@ -1,6 +1,6 @@
 extern crate futures;
 
-use futures::Future;
+use futures::prelude::*;
 use futures::future;
 use futures::unsync::oneshot::{channel, Canceled};
 
diff --git a/tests/unsync.rs b/tests/unsync.rs
index f9d5b796..1ad0ed31 100644
--- a/tests/unsync.rs
+++ b/tests/unsync.rs
@@ -4,7 +4,7 @@ extern crate futures;
 
 mod support;
 
-use futures::{Future, Stream, Sink, Async};
+use futures::prelude::*;
 use futures::unsync::oneshot;
 use futures::unsync::mpsc::{self, SendError};
 use futures::future::lazy;