Skip to content

Commit e68c36a

Browse files
Remove most glob imports
1 parent 1b6e815 commit e68c36a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+138
-216
lines changed

futures-channel/benches/sync_mpsc.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
use futures::ready;
44
use futures::channel::mpsc::{self, Sender, UnboundedSender};
55
use futures::executor::LocalPool;
6-
use futures::prelude::*;
7-
use futures::task::{self, Wake, LocalWaker};
6+
use futures::stream::{Stream, StreamExt};
7+
use futures::sink::Sink;
8+
use futures::task::{self, Poll, Wake, LocalWaker};
89
use std::mem::PinMut;
910
use std::sync::Arc;
1011
use test::Bencher;

futures-channel/src/oneshot.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,22 @@ struct Inner<T> {
8484
///
8585
/// ```
8686
/// use futures::channel::oneshot;
87-
/// use futures::prelude::*;
87+
/// use futures::future::FutureExt;
8888
/// use std::thread;
8989
///
90-
/// fn main() {
91-
/// let (sender, receiver) = oneshot::channel::<i32>();
90+
/// let (sender, receiver) = oneshot::channel::<i32>();
9291
///
9392
/// # let t =
94-
/// thread::spawn(|| {
95-
/// let future = receiver.map(|i| {
96-
/// println!("got: {:?}", i);
97-
/// });
98-
/// // ...
99-
/// # return future;
93+
/// thread::spawn(|| {
94+
/// let future = receiver.map(|i| {
95+
/// println!("got: {:?}", i);
10096
/// });
97+
/// // ...
98+
/// # return future;
99+
/// });
101100
///
102-
/// sender.send(3).unwrap();
101+
/// sender.send(3).unwrap();
103102
/// # futures::executor::block_on(t.join().unwrap());
104-
/// }
105103
/// ```
106104
pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
107105
let inner = Arc::new(Inner::new());

futures-channel/tests/channel.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
use futures::channel::mpsc;
44
use futures::executor::block_on;
55
use futures::future::poll_fn;
6-
use futures::prelude::*;
7-
use std::sync::atomic::*;
6+
use futures::stream::StreamExt;
7+
use futures::sink::SinkExt;
8+
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
89
use std::thread;
910

1011
#[test]

futures-channel/tests/mpsc-close.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use futures::channel::mpsc::*;
1+
use futures::channel::mpsc;
22
use futures::executor::block_on;
3-
use futures::prelude::*;
3+
use futures::sink::SinkExt;
4+
use futures::stream::StreamExt;
45
use std::thread;
56

67
#[test]
78
fn smoke() {
8-
let (mut sender, receiver) = channel(1);
9+
let (mut sender, receiver) = mpsc::channel(1);
910

1011
let t = thread::spawn(move || {
1112
while let Ok(()) = block_on(sender.send(42)) {}

futures-channel/tests/mpsc.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#![feature(futures_api, async_await, await_macro, pin)]
22

3-
use futures::future::poll_fn;
43
use futures::channel::{mpsc, oneshot};
54
use futures::executor::{block_on, block_on_stream};
6-
use futures::prelude::*;
5+
use futures::future::{FutureExt, poll_fn};
6+
use futures::stream::{Stream, StreamExt};
7+
use futures::sink::{Sink, SinkExt};
8+
use futures::task::Poll;
79
use pin_utils::pin_mut;
810
use std::sync::{Arc, Mutex};
911
use std::sync::atomic::{AtomicUsize, Ordering};

futures-channel/tests/oneshot.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#![feature(futures_api, arbitrary_self_types, pin)]
22

3-
use futures::channel::oneshot::*;
3+
use futures::channel::oneshot::{self, Sender};
44
use futures::executor::block_on;
5-
use futures::future::poll_fn;
6-
use futures::task;
7-
use futures::prelude::*;
5+
use futures::future::{Future, FutureExt, poll_fn};
6+
use futures::task::{self, Poll};
87
use std::mem::PinMut;
98
use std::sync::mpsc;
109
use std::thread;
1110

1211
#[test]
1312
fn smoke_poll() {
14-
let (mut tx, rx) = channel::<u32>();
13+
let (mut tx, rx) = oneshot::channel::<u32>();
1514
let mut rx = Some(rx);
1615
let f = poll_fn(|cx| {
1716
assert!(tx.poll_cancel(cx).is_pending());
@@ -27,7 +26,7 @@ fn smoke_poll() {
2726

2827
#[test]
2928
fn cancel_notifies() {
30-
let (tx, rx) = channel::<u32>();
29+
let (tx, rx) = oneshot::channel::<u32>();
3130

3231
let t = thread::spawn(|| {
3332
block_on(WaitForCancel { tx: tx });
@@ -59,7 +58,7 @@ fn cancel_lots() {
5958
});
6059

6160
for _ in 0..20000 {
62-
let (otx, orx) = channel::<u32>();
61+
let (otx, orx) = oneshot::channel::<u32>();
6362
let (tx2, rx2) = mpsc::channel();
6463
tx.send((otx, tx2)).unwrap();
6564
drop(orx);
@@ -72,7 +71,7 @@ fn cancel_lots() {
7271

7372
#[test]
7473
fn close() {
75-
let (mut tx, mut rx) = channel::<u32>();
74+
let (mut tx, mut rx) = oneshot::channel::<u32>();
7675
rx.close();
7776
block_on(poll_fn(|cx| {
7877
match rx.poll_unpin(cx) {
@@ -86,7 +85,7 @@ fn close() {
8685

8786
#[test]
8887
fn close_wakes() {
89-
let (tx, mut rx) = channel::<u32>();
88+
let (tx, mut rx) = oneshot::channel::<u32>();
9089
let (tx2, rx2) = mpsc::channel();
9190
let t = thread::spawn(move || {
9291
rx.close();
@@ -99,7 +98,7 @@ fn close_wakes() {
9998

10099
#[test]
101100
fn is_canceled() {
102-
let (tx, rx) = channel::<u32>();
101+
let (tx, rx) = oneshot::channel::<u32>();
103102
assert!(!tx.is_canceled());
104103
drop(rx);
105104
assert!(tx.is_canceled());
@@ -115,7 +114,7 @@ fn cancel_sends() {
115114
});
116115

117116
for _ in 0..20000 {
118-
let (otx, mut orx) = channel::<u32>();
117+
let (otx, mut orx) = oneshot::channel::<u32>();
119118
tx.send(otx).unwrap();
120119

121120
orx.close();

futures-executor/benches/poll.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![feature(test, pin, arbitrary_self_types, futures_api)]
22

33
use futures::executor::LocalPool;
4-
use futures::task::{self, Waker, LocalWaker, Wake, local_waker_from_nonlocal};
5-
use futures::prelude::*;
4+
use futures::future::{Future, FutureExt};
5+
use futures::task::{self, Poll, Waker, LocalWaker, Wake};
66
use std::marker::Unpin;
77
use std::mem::PinMut;
88
use std::sync::Arc;
@@ -15,7 +15,7 @@ fn notify_noop() -> LocalWaker {
1515
fn wake(_: &Arc<Self>) {}
1616
}
1717

18-
local_waker_from_nonlocal(Arc::new(Noop))
18+
task::local_waker_from_nonlocal(Arc::new(Noop))
1919
}
2020

2121
#[bench]

futures-executor/benches/thread_notify.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![feature(test, futures_api, pin, arbitrary_self_types)]
22

33
use futures::executor::block_on;
4-
use futures::task::{self, Waker};
5-
use futures::prelude::*;
4+
use futures::future::Future;
5+
use futures::task::{self, Poll, Waker};
66
use std::marker::Unpin;
77
use std::mem::PinMut;
88
use test::Bencher;

futures-executor/src/enter.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ pub struct EnterError {
2525
/// execute a tasks, and drop the returned [`Enter`](Enter) value after
2626
/// completing task execution:
2727
///
28-
/// ```rust
29-
/// # use futures::executor::enter;
28+
/// ```
29+
/// use futures::executor::enter;
3030
///
31-
/// # fn main() {
3231
/// let enter = enter().expect("...");
3332
/// /* run task */
3433
/// drop(enter);
35-
/// # }
3634
/// ```
3735
///
3836
/// Doing so ensures that executors aren't

futures-executor/src/local_pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl LocalPool {
125125
/// the `LocalPool` by using its executor handle:
126126
///
127127
/// ```
128-
/// # #![feature(pin, arbitrary_self_types, futures_api)]
128+
/// #![feature(pin, arbitrary_self_types, futures_api)]
129129
/// use futures::executor::LocalPool;
130130
/// use futures::future::ready;
131131
///

futures-executor/tests/local_pool.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
use futures::channel::oneshot;
44
use futures::executor::LocalPool;
5-
use futures::future::lazy;
6-
use futures::task::{self, Executor};
7-
use futures::prelude::*;
5+
use futures::future::{Future, lazy};
6+
use futures::task::{self, Poll, Executor};
87
use std::boxed::PinBox;
98
use std::cell::{Cell, RefCell};
109
use std::mem::PinMut;

futures-util/benches/futures_unordered.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#![feature(test, futures_api)]
22

3-
use futures::prelude::*;
3+
use futures::channel::oneshot;
4+
use futures::executor::block_on;
45
use futures::future;
5-
use futures::stream::FuturesUnordered;
6-
use futures_channel::oneshot;
7-
use futures_executor::block_on;
8-
9-
use test::Bencher;
10-
6+
use futures::stream::{StreamExt, FuturesUnordered};
7+
use futures::task::Poll;
118
use std::collections::VecDeque;
129
use std::thread;
10+
use test::Bencher;
1311

1412
#[bench]
1513
fn oneshots(b: &mut Bencher) {

futures-util/benches_disabled/bilock.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#[cfg(feature = "bench")]
44
mod bench {
5-
use futures::prelude::*;
65
use futures::task::{self, Wake, Waker};
76
use futures::executor::LocalPool;
87
use futures_util::lock::BiLock;

futures-util/bilock.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use futures::prelude::*;
21
use futures::task;
32
use futures::stream;
43
use futures::future;

futures-util/src/future/abortable.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,14 @@ impl<Fut> Abortable<Fut> where Fut: Future {
2929
///
3030
/// Example:
3131
///
32-
/// ```rust
33-
/// use futures::prelude::*;
32+
/// ```
3433
/// use futures::future::{ready, Abortable, AbortHandle, Aborted};
3534
/// use futures::executor::block_on;
3635
///
37-
/// # fn main() {
3836
/// let (abort_handle, abort_registration) = AbortHandle::new_pair();
3937
/// let future = Abortable::new(ready(2), abort_registration);
4038
/// abort_handle.abort();
4139
/// assert_eq!(block_on(future), Err(Aborted));
42-
/// # }
4340
/// ```
4441
pub fn new(future: Fut, reg: AbortRegistration) -> Self {
4542
Abortable {
@@ -71,17 +68,14 @@ impl AbortHandle {
7168
///
7269
/// Example:
7370
///
74-
/// ```rust
75-
/// use futures::prelude::*;
71+
/// ```
7672
/// use futures::future::{ready, Abortable, AbortHandle, Aborted};
7773
/// use futures::executor::block_on;
7874
///
79-
/// # fn main() {
8075
/// let (abort_handle, abort_registration) = AbortHandle::new_pair();
8176
/// let future = Abortable::new(ready(2), abort_registration);
8277
/// abort_handle.abort();
8378
/// assert_eq!(block_on(future), Err(Aborted));
84-
/// # }
8579
pub fn new_pair() -> (Self, AbortRegistration) {
8680
let inner = Arc::new(AbortInner {
8781
waker: AtomicWaker::new(),

futures-util/src/future/disabled/join_all.rs

-4
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,8 @@ impl<F> fmt::Debug for JoinAll<F>
4949
/// # Examples
5050
///
5151
/// ```
52-
/// use futures::prelude::*;
5352
/// use futures::future::{join_all, ok, err};
5453
///
55-
/// # fn main() {
56-
/// #
5754
/// let f = join_all(vec![
5855
/// ok::<u32, u32>(1),
5956
/// ok::<u32, u32>(2),
@@ -72,7 +69,6 @@ impl<F> fmt::Debug for JoinAll<F>
7269
/// assert_eq!(x, Err(2));
7370
/// x
7471
/// });
75-
/// # }
7672
/// ```
7773
pub fn join_all<I>(i: I) -> JoinAll<<I::Item as IntoFuture>::Future>
7874
where I: IntoIterator,

futures-util/src/future/mod.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ pub trait FutureExt: Future {
176176
/// # Examples
177177
///
178178
/// ```
179-
/// use futures::prelude::*;
180179
/// use futures::future::{self, Either};
181180
///
182181
/// // A poor-man's join implemented on top of select
@@ -195,7 +194,6 @@ pub trait FutureExt: Future {
195194
/// }
196195
/// }))
197196
/// }
198-
/// # fn main() {}
199197
/// ```
200198
fn select<B>(self, other: B) -> Select<Self, B::Future>
201199
where B: IntoFuture, Self: Sized
@@ -349,9 +347,7 @@ pub trait FutureExt: Future {
349347
///
350348
/// ```
351349
/// use futures::executor::block_on;
352-
/// use futures::future::*;
353350
///
354-
/// # fn main() {
355351
/// let x = 6;
356352
/// let future = if x < 10 {
357353
/// ready(true).left_future()
@@ -360,7 +356,6 @@ pub trait FutureExt: Future {
360356
/// };
361357
///
362358
/// assert_eq!(true, block_on(future));
363-
/// # }
364359
/// ```
365360
fn left_future<B>(self) -> Either<Self, B>
366361
where B: Future<Output = Self::Output>,
@@ -379,9 +374,7 @@ pub trait FutureExt: Future {
379374
///
380375
/// ```
381376
/// use futures::executor::block_on;
382-
/// use futures::future::*;
383377
///
384-
/// # fn main() {
385378
/// let x = 6;
386379
/// let future = if x < 10 {
387380
/// ready(true).left_future()
@@ -390,7 +383,7 @@ pub trait FutureExt: Future {
390383
/// };
391384
///
392385
/// assert_eq!(false, block_on(future));
393-
/// # }
386+
/// ```
394387
fn right_future<A>(self) -> Either<A, Self>
395388
where A: Future<Output = Self::Output>,
396389
Self: Sized,
@@ -558,7 +551,7 @@ pub trait FutureExt: Future {
558551
///
559552
// TODO: minimize and open rust-lang/rust ticket, currently errors:
560553
// 'assertion failed: !value.has_escaping_regions()'
561-
/// ```rust,ignore
554+
/// ```ignore
562555
/// #![feature(async_await, await_macro, futures_api)]
563556
/// # futures::executor::block_on(async {
564557
/// use futures::future::{self, FutureExt, Ready};
@@ -613,8 +606,7 @@ pub trait FutureExt: Future {
613606
/// // synchronous function to better illustrate the cross-thread aspect of
614607
/// // the `shared` combinator.
615608
///
616-
/// use futures::prelude::*;
617-
/// use futures::future;
609+
/// use futures::future::{self, FutureExt};
618610
/// use futures::executor::block_on;
619611
/// use std::thread;
620612
///

0 commit comments

Comments
 (0)