From eeb44c86e9adfcf2fca7d85dbffaaf96b337efdc Mon Sep 17 00:00:00 2001 From: k-nasa Date: Fri, 1 Nov 2019 10:34:28 +0900 Subject: [PATCH] fix --- src/io/stderr.rs | 6 ++---- src/io/stdin.rs | 6 ++---- src/io/stdout.rs | 6 ++---- src/stream/stream/min.rs | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/io/stderr.rs b/src/io/stderr.rs index 4e727f2..7584dc1 100644 --- a/src/io/stderr.rs +++ b/src/io/stderr.rs @@ -1,4 +1,4 @@ -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use std::io::Write as StdWrite; use std::pin::Pin; use std::sync::Mutex; @@ -120,9 +120,7 @@ impl Stderr { /// # Ok(()) }) } /// ``` pub async fn lock(&self) -> StderrLock<'static> { - lazy_static! { - static ref STDERR: std::io::Stderr = std::io::stderr(); - } + static STDERR: Lazy = Lazy::new(|| std::io::stderr()); blocking::spawn(move || StderrLock(STDERR.lock())).await } diff --git a/src/io/stdin.rs b/src/io/stdin.rs index 9fb28ba..359f2a3 100644 --- a/src/io/stdin.rs +++ b/src/io/stdin.rs @@ -1,4 +1,4 @@ -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use std::pin::Pin; use std::sync::Mutex; @@ -176,9 +176,7 @@ impl Stdin { /// # Ok(()) }) } /// ``` pub async fn lock(&self) -> StdinLock<'static> { - lazy_static! { - static ref STDIN: std::io::Stdin = std::io::stdin(); - } + static STDIN: Lazy = Lazy::new(|| std::io::stdin()); blocking::spawn(move || StdinLock(STDIN.lock())).await } diff --git a/src/io/stdout.rs b/src/io/stdout.rs index c314837..ccfd85b 100644 --- a/src/io/stdout.rs +++ b/src/io/stdout.rs @@ -1,4 +1,4 @@ -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use std::io::Write as StdWrite; use std::pin::Pin; use std::sync::Mutex; @@ -120,9 +120,7 @@ impl Stdout { /// # Ok(()) }) } /// ``` pub async fn lock(&self) -> StdoutLock<'static> { - lazy_static! { - static ref STDOUT: std::io::Stdout = std::io::stdout(); - } + static STDOUT: Lazy = Lazy::new(|| std::io::stdout()); blocking::spawn(move || StdoutLock(STDOUT.lock())).await } diff --git a/src/stream/stream/min.rs b/src/stream/stream/min.rs index 1ab5606..b4a8c7c 100644 --- a/src/stream/stream/min.rs +++ b/src/stream/stream/min.rs @@ -1,5 +1,5 @@ +use std::cmp::{Ord, Ordering}; use std::marker::PhantomData; -use std::cmp::{Ordering, Ord}; use std::pin::Pin; use pin_project_lite::pin_project;