Skip to content

Commit 30a69f7

Browse files
authored
chore: Switch futures_core::ready to standard library api (#436)
`std::task::ready` could be used instead of `futures_core::ready`.
1 parent 34ac711 commit 30a69f7

7 files changed

Lines changed: 11 additions & 18 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ edition = "2018"
1212
[workspace.dependencies]
1313
compression-codecs = { version = "0.4.35", path = "crates/compression-codecs" }
1414
compression-core = { version = "0.4.31", path = "crates/compression-core" }
15-
futures-core = { version = "0.3", default-features = false }
1615
pin-project-lite = "0.2"
1716

1817
[workspace.lints.rust]

crates/async-compression/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ zstdmt = ["compression-codecs/zstdmt", "zstd"]
4949

5050
[dependencies]
5151
# core dependencies
52-
futures-core.workspace = true
5352
pin-project-lite.workspace = true
5453
compression-codecs.workspace = true
5554
compression-core.workspace = true

crates/async-compression/src/generic/bufread/decoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ macro_rules! impl_decoder {
114114
() => {
115115
use crate::generic::bufread::Decoder as GenericDecoder;
116116

117-
use std::ops::ControlFlow;
117+
use std::{ops::ControlFlow, task::ready};
118118

119-
use futures_core::ready;
120119
use pin_project_lite::pin_project;
121120

122121
pin_project! {

crates/async-compression/src/generic/bufread/encoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ macro_rules! impl_encoder {
101101
() => {
102102
use crate::generic::bufread::Encoder as GenericEncoder;
103103

104-
use std::ops::ControlFlow;
104+
use std::{ops::ControlFlow, task::ready};
105105

106-
use futures_core::ready;
107106
use pin_project_lite::pin_project;
108107

109108
pin_project! {

crates/async-compression/src/generic/write/buf_writer.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
use super::AsyncBufWrite;
66
use compression_core::util::WriteBuffer;
7-
use futures_core::ready;
87
use std::{
98
fmt, io,
109
pin::Pin,
11-
task::{Context, Poll},
10+
task::{ready, Context, Poll},
1211
};
1312

1413
const DEFAULT_BUF_SIZE: usize = 8192;
@@ -168,8 +167,8 @@ impl Drop for Buffer<'_> {
168167
macro_rules! impl_buf_writer {
169168
($poll_close: tt) => {
170169
use crate::generic::write::{AsyncBufWrite, BufWriter as GenericBufWriter, Buffer};
171-
use futures_core::ready;
172170
use pin_project_lite::pin_project;
171+
use std::task::ready;
173172

174173
pin_project! {
175174
#[derive(Debug)]

crates/async-compression/src/generic/write/decoder.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ use crate::{
33
core::util::{PartialBuffer, WriteBuffer},
44
generic::write::AsyncBufWrite,
55
};
6-
use futures_core::ready;
76
use std::{
87
io,
98
pin::Pin,
10-
task::{Context, Poll},
9+
task::{ready, Context, Poll},
1110
};
1211

1312
#[derive(Debug)]
@@ -60,7 +59,7 @@ impl Decoder {
6059
}
6160

6261
State::Done => {
63-
return Poll::Ready(Err(io::Error::other("Write after end of stream")))
62+
return Poll::Ready(Err(io::Error::other("Write after end of stream")));
6463
}
6564
};
6665

@@ -144,8 +143,8 @@ macro_rules! impl_decoder {
144143
use crate::{
145144
codecs::DecodeV2, core::util::PartialBuffer, generic::write::Decoder as GenericDecoder,
146145
};
147-
use futures_core::ready;
148146
use pin_project_lite::pin_project;
147+
use std::task::ready;
149148

150149
pin_project! {
151150
#[derive(Debug)]

crates/async-compression/src/generic/write/encoder.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ use crate::{
33
core::util::{PartialBuffer, WriteBuffer},
44
generic::write::AsyncBufWrite,
55
};
6-
use futures_core::ready;
76
use std::{
87
io,
98
pin::Pin,
10-
task::{Context, Poll},
9+
task::{ready, Context, Poll},
1110
};
1211

1312
#[derive(Debug)]
@@ -49,7 +48,7 @@ impl Encoder {
4948
}
5049

5150
State::Finishing | State::Done => {
52-
break Poll::Ready(Err(io::Error::other("Write after close")))
51+
break Poll::Ready(Err(io::Error::other("Write after close")));
5352
}
5453
};
5554

@@ -92,7 +91,7 @@ impl Encoder {
9291
State::Encoding => encoder.flush(output)?,
9392

9493
State::Finishing | State::Done => {
95-
break Poll::Ready(Err(io::Error::other("Flush after close")))
94+
break Poll::Ready(Err(io::Error::other("Flush after close")));
9695
}
9796
};
9897

@@ -134,8 +133,8 @@ impl Encoder {
134133
macro_rules! impl_encoder {
135134
($poll_close: tt) => {
136135
use crate::{codecs::EncodeV2, generic::write::Encoder as GenericEncoder};
137-
use futures_core::ready;
138136
use pin_project_lite::pin_project;
137+
use std::task::ready;
139138

140139
pin_project! {
141140
#[derive(Debug)]

0 commit comments

Comments
 (0)