Skip to content

Commit 2f38dc2

Browse files
committed
Fixes formatting
1 parent 86d45ee commit 2f38dc2

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

src/stream/stream/cmp.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::cmp::Ordering;
22
use std::pin::Pin;
33

44
use super::fuse::Fuse;
5-
use crate::prelude::*;
65
use crate::future::Future;
6+
use crate::prelude::*;
77
use crate::stream::Stream;
88
use crate::task::{Context, Poll};
99

@@ -15,7 +15,7 @@ pub struct CmpFuture<L: Stream, R: Stream> {
1515
l: Fuse<L>,
1616
r: Fuse<R>,
1717
l_cache: Option<L::Item>,
18-
r_cache: Option<R::Item>,
18+
r_cache: Option<R::Item>,
1919
}
2020

2121
impl<L: Stream, R: Stream> CmpFuture<L, R> {
@@ -28,35 +28,35 @@ impl<L: Stream, R: Stream> CmpFuture<L, R> {
2828
CmpFuture {
2929
l: l.fuse(),
3030
r: r.fuse(),
31-
l_cache: None,
32-
r_cache: None,
31+
l_cache: None,
32+
r_cache: None,
3333
}
3434
}
3535
}
3636

37-
impl<L: Stream, R: Stream> Future for CmpFuture<L, R>
38-
where
37+
impl<L: Stream, R: Stream> Future for CmpFuture<L, R>
38+
where
3939
L: Stream + Sized,
4040
R: Stream<Item = L::Item> + Sized,
41-
L::Item: Ord,
41+
L::Item: Ord,
4242
{
4343
type Output = Ordering;
4444

45-
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
45+
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
4646
loop {
4747
// Stream that completes earliest can be considered Less, etc
4848
let l_complete = self.l.done && self.as_mut().l_cache.is_none();
4949
let r_complete = self.r.done && self.as_mut().r_cache.is_none();
5050

5151
if l_complete && r_complete {
52-
return Poll::Ready(Ordering::Equal)
52+
return Poll::Ready(Ordering::Equal);
5353
} else if l_complete {
54-
return Poll::Ready(Ordering::Less)
54+
return Poll::Ready(Ordering::Less);
5555
} else if r_complete {
56-
return Poll::Ready(Ordering::Greater)
56+
return Poll::Ready(Ordering::Greater);
5757
}
5858

59-
// Get next value if possible and necesary
59+
// Get next value if possible and necesary
6060
if !self.l.done && self.as_mut().l_cache.is_none() {
6161
let l_next = futures_core::ready!(self.as_mut().l().poll_next(cx));
6262
if let Some(item) = l_next {
@@ -74,18 +74,18 @@ where
7474
// Compare if both values are available.
7575
if self.as_mut().l_cache.is_some() && self.as_mut().r_cache.is_some() {
7676
let l_value = self.as_mut().l_cache().take().unwrap();
77-
let r_value = self.as_mut().r_cache().take().unwrap();
77+
let r_value = self.as_mut().r_cache().take().unwrap();
7878
let result = l_value.cmp(&r_value);
7979

8080
if let Ordering::Equal = result {
81-
// Reset cache to prepare for next comparison
82-
*self.as_mut().l_cache() = None;
81+
// Reset cache to prepare for next comparison
82+
*self.as_mut().l_cache() = None;
8383
*self.as_mut().r_cache() = None;
8484
} else {
85-
// Return non equal value
85+
// Return non equal value
8686
return Poll::Ready(result);
87-
}
87+
}
8888
}
8989
}
9090
}
91-
}
91+
}

src/stream/stream/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,6 @@ extension_trait! {
11881188
}
11891189

11901190
#[doc = r#"
1191-
<<<<<<< HEAD
11921191
Combines multiple streams into a single stream of all their outputs.
11931192
11941193
Items are yielded as soon as they're received, and the stream continues yield until both
@@ -1295,10 +1294,10 @@ extension_trait! {
12951294
fn cmp<S>(
12961295
self,
12971296
other: S
1298-
) -> impl Future<Output = Ordering> + '_ [CmpFuture<Self, S>]
1297+
) -> impl Future<Output = Ordering> + '_ [CmpFuture<Self, S>]
12991298
where
13001299
Self: Sized + Stream,
1301-
S: Stream<Item = Self::Item>,
1300+
S: Stream<Item = Self::Item>,
13021301
Self::Item: Ord,
13031302
{
13041303
CmpFuture::new(self, other)

0 commit comments

Comments
 (0)