Remove Unneeded Imports (#552)

This commit is contained in:
SirWindfield 2021-03-28 13:49:38 +02:00 committed by GitHub
parent b450b67812
commit b4bdbfc9f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 10 deletions

View File

@ -2,10 +2,7 @@
//!
//! cargo run --features="event-stream" --example event-stream-async-std
use std::{
io::{stdout, Write},
time::Duration,
};
use std::{io::stdout, time::Duration};
use futures::{future::FutureExt, select, StreamExt};
use futures_timer::Delay;

View File

@ -2,10 +2,7 @@
//!
//! cargo run --features="event-stream" --example event-stream-tokio
use std::{
io::{stdout, Write},
time::Duration,
};
use std::{io::stdout, time::Duration};
use futures::{future::FutureExt, select, StreamExt};
use futures_timer::Delay;

View File

@ -113,7 +113,9 @@ impl Stream for EventStream {
Ok(false) => {
if !self
.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_wake_task_executed = self.stream_wake_task_executed.clone();

View File

@ -27,12 +27,13 @@ impl Waker {
.lock()
.unwrap()
.wake()
.map_err(|e| ErrorKind::IoError(e))
.map_err(ErrorKind::IoError)
}
/// Resets the state so the same waker can be reused.
///
/// This function is not impl
#[allow(dead_code, clippy::clippy::unnecessary_wraps)]
pub(crate) fn reset(&self) -> Result<()> {
Ok(())
}