Skip to content

Commit c87dab2

Browse files
committed
rustfmt
1 parent ad05101 commit c87dab2

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

Diff for: src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ pub mod io;
4848
pub mod net;
4949
pub mod os;
5050
pub mod prelude;
51+
mod result;
5152
pub mod stream;
5253
pub mod sync;
5354
pub mod task;
5455
mod vec;
55-
mod result;
5656

5757
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
5858
#[cfg(feature = "unstable")]

Diff for: src/result/from_stream.rs

+16-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ use crate::stream::{FromStream, IntoStream, Stream};
33
use std::pin::Pin;
44

55
impl<T: Send, E: Send, V> FromStream<Result<T, E>> for Result<V, E>
6-
where V: FromStream<T> {
6+
where
7+
V: FromStream<T>,
8+
{
79
/// Takes each element in the stream: if it is an `Err`, no further
810
/// elements are taken, and the `Err` is returned. Should no `Err`
911
/// occur, a container with the values of each `Result` is returned.
@@ -22,16 +24,19 @@ impl<T: Send, E: Send, V> FromStream<Result<T, E>> for Result<V, E>
2224
// Using `scan` here because it is able to stop the stream early
2325
// if a failure occurs
2426
let mut found_error = None;
25-
let out: V = stream.scan((), |_, elem| {
26-
match elem {
27-
Ok(elem) => Some(elem),
28-
Err(err) => {
29-
found_error = Some(err);
30-
// Stop processing the stream on error
31-
None
32-
},
33-
}
34-
}).collect().await;
27+
let out: V = stream
28+
.scan((), |_, elem| {
29+
match elem {
30+
Ok(elem) => Some(elem),
31+
Err(err) => {
32+
found_error = Some(err);
33+
// Stop processing the stream on error
34+
None
35+
}
36+
}
37+
})
38+
.collect()
39+
.await;
3540

3641
match found_error {
3742
Some(err) => Err(err),
@@ -40,4 +45,3 @@ impl<T: Send, E: Send, V> FromStream<Result<T, E>> for Result<V, E>
4045
}))
4146
}
4247
}
43-

0 commit comments

Comments
 (0)