mirror of
https://github.com/async-rs/async-std.git
synced 2025-05-16 20:11:29 +00:00
Apply suggestions from code review
Co-authored-by: nasa <htilcs1115@gmail.com>
This commit is contained in:
parent
68063adddf
commit
2323ac9a8e
2 changed files with 13 additions and 25 deletions
|
@ -51,21 +51,15 @@ where
|
||||||
let mut this = self.project();
|
let mut this = self.project();
|
||||||
loop {
|
loop {
|
||||||
if let Some(inner) = this.inner_stream.as_mut().as_pin_mut() {
|
if let Some(inner) = this.inner_stream.as_mut().as_pin_mut() {
|
||||||
let next_item = futures_core::ready!(inner.poll_next(cx));
|
match futures_core::ready!(inner.poll_next(cx)) {
|
||||||
|
item @ Some(_) => return Poll::Ready(item),
|
||||||
if next_item.is_some() {
|
None => this.inner_stream.set(None),
|
||||||
return Poll::Ready(next_item);
|
|
||||||
} else {
|
|
||||||
this.inner_stream.set(None);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let inner = futures_core::ready!(this.stream.as_mut().poll_next(cx));
|
match futures_core::ready!(this.stream.as_mut().poll_next(cx)) {
|
||||||
|
inner @ Some(_) => this.inner_stream.set(inner.map(IntoStream::into_stream)),
|
||||||
if inner.is_some() {
|
None => return Poll::Ready(None),
|
||||||
this.inner_stream.set(inner.map(IntoStream::into_stream));
|
|
||||||
} else {
|
|
||||||
return Poll::Ready(None);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,21 +52,15 @@ where
|
||||||
let mut this = self.project();
|
let mut this = self.project();
|
||||||
loop {
|
loop {
|
||||||
if let Some(inner) = this.inner_stream.as_mut().as_pin_mut() {
|
if let Some(inner) = this.inner_stream.as_mut().as_pin_mut() {
|
||||||
let next_item = futures_core::ready!(inner.poll_next(cx));
|
match futures_core::ready!(inner.poll_next(cx)) {
|
||||||
|
item @ Some(_) => return Poll::Ready(next_item),
|
||||||
if next_item.is_some() {
|
None => this.inner_stream.set(None),
|
||||||
return Poll::Ready(next_item);
|
|
||||||
} else {
|
|
||||||
this.inner_stream.set(None);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let inner = futures_core::ready!(this.stream.as_mut().poll_next(cx));
|
match futures_core::ready!(this.stream.as_mut().poll_next(cx)) {
|
||||||
|
inner @ Some(_) => this.inner_stream.set(inner.map(IntoStream::into_stream)),
|
||||||
if inner.is_some() {
|
None => Poll::Ready(None),
|
||||||
this.inner_stream.set(inner.map(IntoStream::into_stream));
|
|
||||||
} else {
|
|
||||||
return Poll::Ready(None);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue