Skip to content

Commit

Permalink
More clipy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed Jan 23, 2025
1 parent b3a3c5c commit c8b9a48
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions src/path/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/path/pathbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/stream/stream/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/stream/stream/find_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion src/stream/stream/nth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{
Expand Down
4 changes: 2 additions & 2 deletions src/stream/stream/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/stream/stream/try_fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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>,
Expand Down
4 changes: 2 additions & 2 deletions src/stream/stream/try_for_each.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ 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 {
Self { stream, 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>,
Expand Down
32 changes: 16 additions & 16 deletions tests/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
})
}

Expand Down

0 comments on commit c8b9a48

Please sign in to comment.