Skip to content

Commit ee18645

Browse files
committed
Rustfmt down to 80 characters
1 parent 01aee68 commit ee18645

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

.rustfmt.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
max_width = 80
2+
comment_width = 80

futures-util/src/compat/compat01to03.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ use std::mem::PinMut;
1212
impl<Fut: Future01> Future03 for Compat<Fut, ()> {
1313
type Output = Result<Fut::Item, Fut::Error>;
1414

15-
fn poll(self: PinMut<Self>, cx: &mut task03::Context) -> task03::Poll<Self::Output> {
15+
fn poll(
16+
self: PinMut<Self>,
17+
cx: &mut task03::Context,
18+
) -> task03::Poll<Self::Output> {
1619
let notify = &WakerToHandle(cx.waker());
1720

1821
executor01::with_notify(notify, 0, move || {
@@ -28,7 +31,10 @@ impl<Fut: Future01> Future03 for Compat<Fut, ()> {
2831
impl<St: Stream01> Stream03 for Compat<St, ()> {
2932
type Item = Result<St::Item, St::Error>;
3033

31-
fn poll_next(self: PinMut<Self>, cx: &mut task03::Context) -> task03::Poll<Option<Self::Item>> {
34+
fn poll_next(
35+
self: PinMut<Self>,
36+
cx: &mut task03::Context,
37+
) -> task03::Poll<Option<Self::Item>> {
3238
let notify = &WakerToHandle(cx.waker());
3339

3440
executor01::with_notify(notify, 0, move || {

futures-util/src/compat/compat03to01.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
use super::Compat;
22
use futures::{
3-
task as task01, Async as Async01, AsyncSink as AsyncSink01, Future as Future01, Poll as Poll01,
4-
Sink as Sink01, StartSend as StartSend01, Stream as Stream01,
3+
task as task01, Async as Async01, AsyncSink as AsyncSink01,
4+
Future as Future01, Poll as Poll01, Sink as Sink01,
5+
StartSend as StartSend01, Stream as Stream01,
6+
};
7+
use futures_core::{
8+
task as task03, TryFuture as TryFuture03, TryStream as TryStream03,
59
};
6-
use futures_core::{task as task03, TryFuture as TryFuture03, TryStream as TryStream03};
710
use futures_sink::Sink as Sink03;
811
use std::{marker::Unpin, mem::PinMut, sync::Arc};
912

@@ -50,10 +53,15 @@ where
5053
type SinkItem = T::SinkItem;
5154
type SinkError = T::SinkError;
5255

53-
fn start_send(&mut self, item: Self::SinkItem) -> StartSend01<Self::SinkItem, Self::SinkError> {
56+
fn start_send(
57+
&mut self,
58+
item: Self::SinkItem,
59+
) -> StartSend01<Self::SinkItem, Self::SinkError> {
5460
with_context(self, |mut inner, cx| {
5561
match inner.reborrow().poll_ready(cx) {
56-
task03::Poll::Ready(Ok(())) => inner.start_send(item).map(|()| AsyncSink01::Ready),
62+
task03::Poll::Ready(Ok(())) => {
63+
inner.start_send(item).map(|()| AsyncSink01::Ready)
64+
}
5765
task03::Poll::Pending => Ok(AsyncSink01::NotReady(item)),
5866
task03::Poll::Ready(Err(e)) => Err(e),
5967
}
@@ -97,6 +105,7 @@ where
97105
F: FnOnce(PinMut<T>, &mut task03::Context) -> R,
98106
{
99107
let waker = current_as_waker();
100-
let mut cx = task03::Context::new(&waker, compat.executor.as_mut().unwrap());
108+
let executor = compat.executor.as_mut().unwrap();
109+
let mut cx = task03::Context::new(&waker, executor);
101110
f(PinMut::new(&mut compat.inner), &mut cx)
102111
}

0 commit comments

Comments
 (0)