mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
ci: fix clippy warnings (#5891)
Signed-off-by: Jiahao XU <[email protected]>
This commit is contained in:
@@ -994,7 +994,7 @@ pub trait StreamExt: Stream {
|
||||
/// assert!(timeout_stream.try_next().await.is_ok(), "expected no more timeouts");
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg(all(feature = "time"))]
|
||||
#[cfg(feature = "time")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
|
||||
fn timeout(self, duration: Duration) -> Timeout<Self>
|
||||
where
|
||||
@@ -1083,7 +1083,7 @@ pub trait StreamExt: Stream {
|
||||
/// assert!(timeout_stream.try_next().await.is_ok(), "expected non-timeout");
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg(all(feature = "time"))]
|
||||
#[cfg(feature = "time")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
|
||||
fn timeout_repeating(self, interval: Interval) -> TimeoutRepeating<Self>
|
||||
where
|
||||
@@ -1113,7 +1113,7 @@ pub trait StreamExt: Stream {
|
||||
/// }
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg(all(feature = "time"))]
|
||||
#[cfg(feature = "time")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
|
||||
fn throttle(self, duration: Duration) -> Throttle<Self>
|
||||
where
|
||||
|
||||
@@ -64,11 +64,11 @@ where
|
||||
|
||||
let (lower, upper) = self.stream.size_hint();
|
||||
|
||||
let lower = cmp::min(lower, self.remaining as usize);
|
||||
let lower = cmp::min(lower, self.remaining);
|
||||
|
||||
let upper = match upper {
|
||||
Some(x) if x < self.remaining as usize => Some(x),
|
||||
_ => Some(self.remaining as usize),
|
||||
Some(x) if x < self.remaining => Some(x),
|
||||
_ => Some(self.remaining),
|
||||
};
|
||||
|
||||
(lower, upper)
|
||||
|
||||
@@ -234,7 +234,7 @@ impl<T: tokio::io::AsyncSeek> futures_io::AsyncSeek for Compat<T> {
|
||||
}
|
||||
let res = ready!(self.as_mut().project().inner.poll_complete(cx));
|
||||
*self.as_mut().project().seek_pos = None;
|
||||
Poll::Ready(res.map(|p| p as u64))
|
||||
Poll::Ready(res)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ impl<T: futures_io::AsyncSeek> tokio::io::AsyncSeek for Compat<T> {
|
||||
};
|
||||
let res = ready!(self.as_mut().project().inner.poll_seek(cx, pos));
|
||||
*self.as_mut().project().seek_pos = None;
|
||||
Poll::Ready(res.map(|p| p as u64))
|
||||
Poll::Ready(res)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ impl<E: Source> PollEvented<E> {
|
||||
}
|
||||
|
||||
/// Returns a reference to the registration.
|
||||
#[cfg(any(feature = "net"))]
|
||||
#[cfg(feature = "net")]
|
||||
pub(crate) fn registration(&self) -> &Registration {
|
||||
&self.registration
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ cfg_io_util! {
|
||||
) => {
|
||||
$(
|
||||
$(#[$outer])*
|
||||
fn $name<'a>(&'a mut self) -> $($fut)*<&'a mut Self> where Self: Unpin {
|
||||
fn $name(&mut self) -> $($fut)*<&mut Self> where Self: Unpin {
|
||||
$($fut)*::new(self)
|
||||
}
|
||||
)*
|
||||
|
||||
@@ -30,7 +30,7 @@ cfg_io_util! {
|
||||
) => {
|
||||
$(
|
||||
$(#[$outer])*
|
||||
fn $name<'a>(&'a mut self, n: $ty) -> $($fut)*<&'a mut Self> where Self: Unpin {
|
||||
fn $name(&mut self, n: $ty) -> $($fut)*<&mut Self> where Self: Unpin {
|
||||
$($fut)*::new(self, n)
|
||||
}
|
||||
)*
|
||||
|
||||
@@ -523,7 +523,7 @@ impl TcpSocket {
|
||||
/// works for some socket types, particularly `AF_INET` sockets.
|
||||
///
|
||||
/// If `interface` is `None` or an empty string it removes the binding.
|
||||
#[cfg(all(any(target_os = "android", target_os = "fuchsia", target_os = "linux")))]
|
||||
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
|
||||
#[cfg_attr(
|
||||
docsrs,
|
||||
doc(cfg(all(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))))
|
||||
|
||||
@@ -1921,7 +1921,7 @@ impl UdpSocket {
|
||||
/// works for some socket types, particularly `AF_INET` sockets.
|
||||
///
|
||||
/// If `interface` is `None` or an empty string it removes the binding.
|
||||
#[cfg(all(any(target_os = "android", target_os = "fuchsia", target_os = "linux")))]
|
||||
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
|
||||
#[cfg_attr(
|
||||
docsrs,
|
||||
doc(cfg(all(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))))
|
||||
|
||||
@@ -39,7 +39,7 @@ impl UCred {
|
||||
))]
|
||||
pub(crate) use self::impl_linux::get_peer_cred;
|
||||
|
||||
#[cfg(any(target_os = "netbsd"))]
|
||||
#[cfg(target_os = "netbsd")]
|
||||
pub(crate) use self::impl_netbsd::get_peer_cred;
|
||||
|
||||
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
|
||||
@@ -114,7 +114,7 @@ pub(crate) mod impl_linux {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "netbsd"))]
|
||||
#[cfg(target_os = "netbsd")]
|
||||
pub(crate) mod impl_netbsd {
|
||||
use crate::net::unix::{self, UnixStream};
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ where
|
||||
}
|
||||
}
|
||||
let header_ptr = self.header_ptr();
|
||||
let waker_ref = waker_ref::<T, S>(&header_ptr);
|
||||
let waker_ref = waker_ref::<S>(&header_ptr);
|
||||
let cx = Context::from_waker(&waker_ref);
|
||||
let res = poll_future(self.core(), cx);
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ impl<S: 'static> LocalOwnedTasks<S> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test))]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::future::Future;
|
||||
use crate::runtime::task::{Header, RawTask, Schedule};
|
||||
|
||||
use std::marker::PhantomData;
|
||||
@@ -14,9 +13,8 @@ pub(super) struct WakerRef<'a, S: 'static> {
|
||||
|
||||
/// Returns a `WakerRef` which avoids having to preemptively increase the
|
||||
/// refcount if there is no need to do so.
|
||||
pub(super) fn waker_ref<T, S>(header: &NonNull<Header>) -> WakerRef<'_, S>
|
||||
pub(super) fn waker_ref<S>(header: &NonNull<Header>) -> WakerRef<'_, S>
|
||||
where
|
||||
T: Future,
|
||||
S: Schedule,
|
||||
{
|
||||
// `Waker::will_wake` uses the VTABLE pointer as part of the check. This
|
||||
|
||||
Reference in New Issue
Block a user