2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-02-06 12:45:32 +00:00

More clipy fixes

This commit is contained in:
John Vandenberg 2025-01-23 09:39:09 +08:00
parent b3a3c5ce28
commit c8b9a48402
9 changed files with 31 additions and 31 deletions

View file

@ -1015,9 +1015,9 @@ impl<'a> From<&'a std::path::Path> for &'a Path {
}
}
impl<'a> Into<&'a std::path::Path> for &'a Path {
fn into(self) -> &'a std::path::Path {
std::path::Path::new(&self.inner)
impl<'a> From<&'a Path> for &'a std::path::Path {
fn from(val: &'a Path) -> Self {
std::path::Path::new(&val.inner)
}
}

View file

@ -364,9 +364,9 @@ impl From<std::path::PathBuf> for PathBuf {
}
}
impl Into<std::path::PathBuf> for PathBuf {
fn into(self) -> std::path::PathBuf {
self.inner
impl From<PathBuf> for std::path::PathBuf {
fn from(val: PathBuf) -> Self {
val.inner
}
}

View file

@ -19,7 +19,7 @@ impl<'a, S, P> FindFuture<'a, S, P> {
impl<S: Unpin, P> Unpin for FindFuture<'_, S, P> {}
impl<'a, S, P> Future for FindFuture<'a, S, P>
impl<S, P> Future for FindFuture<'_, S, P>
where
S: Stream + Unpin + Sized,
P: FnMut(&S::Item) -> bool,

View file

@ -19,7 +19,7 @@ impl<'a, S, F> FindMapFuture<'a, S, F> {
impl<S: Unpin, F> Unpin for FindMapFuture<'_, S, F> {}
impl<'a, S, B, F> Future for FindMapFuture<'a, S, F>
impl<S, B, F> Future for FindMapFuture<'_, S, F>
where
S: Stream + Unpin + Sized,
F: FnMut(S::Item) -> Option<B>,

View file

@ -19,7 +19,7 @@ impl<'a, S> NthFuture<'a, S> {
}
}
impl<'a, S> Future for NthFuture<'a, S>
impl<S> Future for NthFuture<'_, S>
where
S: Stream + Unpin + Sized,
{

View file

@ -12,7 +12,7 @@ pub struct PositionFuture<'a, S, P> {
index: usize,
}
impl<'a, S, P> Unpin for PositionFuture<'a, S, P> {}
impl<S, P> Unpin for PositionFuture<'_, S, P> {}
impl<'a, S, P> PositionFuture<'a, S, P> {
pub(super) fn new(stream: &'a mut S, predicate: P) -> Self {
@ -24,7 +24,7 @@ impl<'a, S, P> PositionFuture<'a, S, P> {
}
}
impl<'a, S, P> Future for PositionFuture<'a, S, P>
impl<S, P> Future for PositionFuture<'_, S, P>
where
S: Stream + Unpin,
P: FnMut(S::Item) -> bool,

View file

@ -12,7 +12,7 @@ pub struct TryFoldFuture<'a, S, F, T> {
acc: Option<T>,
}
impl<'a, S, F, T> Unpin for TryFoldFuture<'a, S, F, T> {}
impl<S, F, T> Unpin for TryFoldFuture<'_, S, F, T> {}
impl<'a, S, F, T> TryFoldFuture<'a, S, F, T> {
pub(super) fn new(stream: &'a mut S, init: T, f: F) -> Self {
@ -24,7 +24,7 @@ impl<'a, S, F, T> TryFoldFuture<'a, S, F, T> {
}
}
impl<'a, S, F, T, E> Future for TryFoldFuture<'a, S, F, T>
impl<S, F, T, E> Future for TryFoldFuture<'_, S, F, T>
where
S: Stream + Unpin,
F: FnMut(T, S::Item) -> Result<T, E>,

View file

@ -11,7 +11,7 @@ pub struct TryForEachFuture<'a, S, F> {
f: F,
}
impl<'a, S, F> Unpin for TryForEachFuture<'a, S, F> {}
impl<S, F> Unpin for TryForEachFuture<'_, S, F> {}
impl<'a, S, F> TryForEachFuture<'a, S, F> {
pub(crate) fn new(stream: &'a mut S, f: F) -> Self {
@ -19,7 +19,7 @@ impl<'a, S, F> TryForEachFuture<'a, S, F> {
}
}
impl<'a, S, F, E> Future for TryForEachFuture<'a, S, F>
impl<S, F, E> Future for TryForEachFuture<'_, S, F>
where
S: Stream + Unpin,
F: FnMut(S::Item) -> Result<(), E>,

View file

@ -59,38 +59,38 @@ fn len_empty_full() {
let (s, r) = channel(2);
assert_eq!(s.len(), 0);
assert_eq!(s.is_empty(), true);
assert_eq!(s.is_full(), false);
assert!(s.is_empty());
assert!(!s.is_full());
assert_eq!(r.len(), 0);
assert_eq!(r.is_empty(), true);
assert_eq!(r.is_full(), false);
assert!(r.is_empty());
assert!(!r.is_full());
s.send(()).await.unwrap();
assert_eq!(s.len(), 1);
assert_eq!(s.is_empty(), false);
assert_eq!(s.is_full(), false);
assert!(!s.is_empty());
assert!(!s.is_full());
assert_eq!(r.len(), 1);
assert_eq!(r.is_empty(), false);
assert_eq!(r.is_full(), false);
assert!(!r.is_empty());
assert!(!r.is_full());
s.send(()).await.unwrap();
assert_eq!(s.len(), 2);
assert_eq!(s.is_empty(), false);
assert_eq!(s.is_full(), true);
assert!(!s.is_empty());
assert!(s.is_full());
assert_eq!(r.len(), 2);
assert_eq!(r.is_empty(), false);
assert_eq!(r.is_full(), true);
assert!(!r.is_empty());
assert!(r.is_full());
let _ = r.recv().await;
assert_eq!(s.len(), 1);
assert_eq!(s.is_empty(), false);
assert_eq!(s.is_full(), false);
assert!(!s.is_empty());
assert!(!s.is_full());
assert_eq!(r.len(), 1);
assert_eq!(r.is_empty(), false);
assert_eq!(r.is_full(), false);
assert!(!r.is_empty());
assert!(!r.is_full());
})
}