Skip to content

Commit eb939b9

Browse files
committed
future proof: apply fixes for github.com/rust-lang/rust-clippy/pull/9476
1 parent a5670e3 commit eb939b9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

futures-util/src/stream/stream/chunks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<St: Stream> Stream for Chunks<St> {
7777
}
7878

7979
fn size_hint(&self) -> (usize, Option<usize>) {
80-
let chunk_len = if self.items.is_empty() { 0 } else { 1 };
80+
let chunk_len = usize::from(!self.items.is_empty());
8181
let (lower, upper) = self.stream.size_hint();
8282
let lower = (lower / self.cap).saturating_add(chunk_len);
8383
let upper = match upper {

futures-util/src/stream/stream/ready_chunks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<St: Stream> Stream for ReadyChunks<St> {
8585
}
8686

8787
fn size_hint(&self) -> (usize, Option<usize>) {
88-
let chunk_len = if self.items.is_empty() { 0 } else { 1 };
88+
let chunk_len = usize::from(!self.items.is_empty());
8989
let (lower, upper) = self.stream.size_hint();
9090
let lower = (lower / self.cap).saturating_add(chunk_len);
9191
let upper = match upper {

futures-util/src/stream/try_stream/try_chunks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl<St: TryStream> Stream for TryChunks<St> {
8282
}
8383

8484
fn size_hint(&self) -> (usize, Option<usize>) {
85-
let chunk_len = if self.items.is_empty() { 0 } else { 1 };
85+
let chunk_len = usize::from(!self.items.is_empty());
8686
let (lower, upper) = self.stream.size_hint();
8787
let lower = (lower / self.cap).saturating_add(chunk_len);
8888
let upper = match upper {

0 commit comments

Comments
 (0)