Remove Unneeded Imports (#552)
This commit is contained in:
parent
b450b67812
commit
b4bdbfc9f3
@ -2,10 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! cargo run --features="event-stream" --example event-stream-async-std
|
//! cargo run --features="event-stream" --example event-stream-async-std
|
||||||
|
|
||||||
use std::{
|
use std::{io::stdout, time::Duration};
|
||||||
io::{stdout, Write},
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
|
|
||||||
use futures::{future::FutureExt, select, StreamExt};
|
use futures::{future::FutureExt, select, StreamExt};
|
||||||
use futures_timer::Delay;
|
use futures_timer::Delay;
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! cargo run --features="event-stream" --example event-stream-tokio
|
//! cargo run --features="event-stream" --example event-stream-tokio
|
||||||
|
|
||||||
use std::{
|
use std::{io::stdout, time::Duration};
|
||||||
io::{stdout, Write},
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
|
|
||||||
use futures::{future::FutureExt, select, StreamExt};
|
use futures::{future::FutureExt, select, StreamExt};
|
||||||
use futures_timer::Delay;
|
use futures_timer::Delay;
|
||||||
|
@ -113,7 +113,9 @@ impl Stream for EventStream {
|
|||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
if !self
|
if !self
|
||||||
.stream_wake_task_executed
|
.stream_wake_task_executed
|
||||||
.compare_and_swap(false, true, Ordering::SeqCst)
|
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)
|
||||||
|
// https://github.com/rust-lang/rust/issues/80486#issuecomment-752244166
|
||||||
|
.unwrap_or_else(|x| x)
|
||||||
{
|
{
|
||||||
let stream_waker = cx.waker().clone();
|
let stream_waker = cx.waker().clone();
|
||||||
let stream_wake_task_executed = self.stream_wake_task_executed.clone();
|
let stream_wake_task_executed = self.stream_wake_task_executed.clone();
|
||||||
|
@ -27,12 +27,13 @@ impl Waker {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.wake()
|
.wake()
|
||||||
.map_err(|e| ErrorKind::IoError(e))
|
.map_err(ErrorKind::IoError)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets the state so the same waker can be reused.
|
/// Resets the state so the same waker can be reused.
|
||||||
///
|
///
|
||||||
/// This function is not impl
|
/// This function is not impl
|
||||||
|
#[allow(dead_code, clippy::clippy::unnecessary_wraps)]
|
||||||
pub(crate) fn reset(&self) -> Result<()> {
|
pub(crate) fn reset(&self) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user