Skip to content

Commit 79903a6

Browse files
authored
Merge pull request #170 from matheus-consoli/fix-clippy-warnings
2 parents ac90582 + 78e51a6 commit 79903a6

File tree

25 files changed

+75
-44
lines changed

25 files changed

+75
-44
lines changed

src/future/future_group.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ impl<F: Future> FutureGroup<F> {
301301
for index in this.keys.iter().cloned() {
302302
if states[index].is_pending() && readiness.clear_ready(index) {
303303
// unlock readiness so we don't deadlock when polling
304+
#[allow(clippy::drop_non_drop)]
304305
drop(readiness);
305306

306307
// Obtain the intermediate waker.

src/future/join/array.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ where
104104
for (i, mut fut) in this.futures.iter().enumerate() {
105105
if this.state[i].is_pending() && readiness.clear_ready(i) {
106106
// unlock readiness so we don't deadlock when polling
107+
#[allow(clippy::drop_non_drop)]
107108
drop(readiness);
108109

109110
// Obtain the intermediate waker.

src/future/join/tuple.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ macro_rules! impl_join_tuple {
212212
}
213213

214214
// unlock readiness so we don't deadlock when polling
215+
#[allow(clippy::drop_non_drop)]
215216
drop(readiness);
216217

217218
// obtain the intermediate waker

src/future/join/vec.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use super::Join as JoinTrait;
22
use crate::utils::{FutureVec, OutputVec, PollVec, WakerVec};
33

4+
#[cfg(all(feature = "alloc", not(feature = "std")))]
45
use alloc::vec::Vec;
6+
57
use core::fmt;
68
use core::future::{Future, IntoFuture};
79
use core::mem::ManuallyDrop;
@@ -98,6 +100,7 @@ where
98100
for (i, mut fut) in futures.iter().enumerate() {
99101
if states[i].is_pending() && readiness.clear_ready(i) {
100102
// unlock readiness so we don't deadlock when polling
103+
#[allow(clippy::drop_non_drop)]
101104
drop(readiness);
102105

103106
// Obtain the intermediate waker.
@@ -178,8 +181,6 @@ mod test {
178181
use alloc::sync::Arc;
179182
use alloc::vec;
180183
use core::future;
181-
use core::future::Future;
182-
use core::task::Context;
183184

184185
#[test]
185186
fn smoke() {

src/future/race/vec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ use crate::utils::{self, Indexer};
22

33
use super::Race as RaceTrait;
44

5+
#[cfg(all(feature = "alloc", not(feature = "std")))]
56
use alloc::vec::Vec;
7+
68
use core::fmt;
79
use core::future::{Future, IntoFuture};
810
use core::pin::Pin;

src/future/race_ok/tuple/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ macro_rules! impl_race_ok_tuple {
7878
}
7979
}
8080

81-
impl<T, ERR, $($F: Future),*> Future for $StructName<T, ERR, $($F),*>
81+
impl<T, ERR, $($F),*> Future for $StructName<T, ERR, $($F),*>
8282
where
8383
$( $F: Future<Output = Result<T, ERR>>, )*
8484
ERR: fmt::Debug,
@@ -138,7 +138,7 @@ macro_rules! impl_race_ok_tuple {
138138
}
139139

140140
#[pinned_drop]
141-
impl<T, ERR, $($F: Future,)*> PinnedDrop for $StructName<T, ERR, $($F,)*>
141+
impl<T, ERR, $($F,)*> PinnedDrop for $StructName<T, ERR, $($F,)*>
142142
where
143143
$( $F: Future<Output = Result<T, ERR>>, )*
144144
ERR: fmt::Debug,

src/future/race_ok/vec/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#[cfg(all(feature = "alloc", not(feature = "std")))]
12
use alloc::vec::Vec;
3+
24
use core::fmt;
35
use core::ops::Deref;
46
use core::ops::DerefMut;

src/future/race_ok/vec/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ use super::RaceOk as RaceOkTrait;
22
use crate::utils::iter_pin_mut;
33
use crate::utils::MaybeDone;
44

5-
use alloc::boxed::Box;
6-
use alloc::vec::Vec;
5+
#[cfg(all(feature = "alloc", not(feature = "std")))]
6+
use alloc::{boxed::Box, vec::Vec};
7+
78
use core::fmt;
89
use core::future::{Future, IntoFuture};
910
use core::mem;
@@ -94,7 +95,6 @@ where
9495

9596
#[cfg(test)]
9697
mod test {
97-
use super::error::AggregateError;
9898
use super::*;
9999
use alloc::vec;
100100
use core::future;

src/future/try_join/array.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ where
104104
for (i, mut fut) in this.futures.iter().enumerate() {
105105
if this.state[i].is_pending() && readiness.clear_ready(i) {
106106
// unlock readiness so we don't deadlock when polling
107+
#[allow(clippy::drop_non_drop)]
107108
drop(readiness);
108109

109110
// Obtain the intermediate waker.

src/future/try_join/tuple.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ macro_rules! impl_try_join_tuple {
245245
}
246246

247247
// unlock readiness so we don't deadlock when polling
248+
#[allow(clippy::drop_non_drop)]
248249
drop(readiness);
249250

250251
// obtain the intermediate waker
@@ -354,7 +355,7 @@ mod test {
354355
let res: Result<(_, char), ()> = (future::ready(Ok("hello")), future::ready(Err(())))
355356
.try_join()
356357
.await;
357-
assert_eq!(res.unwrap_err(), ());
358+
assert_eq!(res, Err(()));
358359
})
359360
}
360361

0 commit comments

Comments
 (0)