Skip to content

Commit

Permalink
Fix CI by fixing clippy on rust 1.78.0
Browse files Browse the repository at this point in the history
  • Loading branch information
inetic committed May 17, 2024
1 parent 79ba5ba commit e71c4bf
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 51 deletions.
2 changes: 0 additions & 2 deletions lib/src/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ pub(crate) mod hash_map {
}

pub(crate) mod hash_set {
pub use std::collections::hash_set::IntoIter;

use super::hash_map::RandomState;

pub type HashSet<T, S = RandomState> = std::collections::HashSet<T, S>;
Expand Down
8 changes: 4 additions & 4 deletions lib/src/db/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ pub(crate) struct Connection(pub(super) SqliteConnection);
impl<'t> Executor<'t> for &'t mut Connection {
type Database = Sqlite;

fn fetch_many<'e, 'q: 'e, E: 'q>(
fn fetch_many<'e, 'q: 'e, E>(
self,
query: E,
) -> BoxStream<'e, Result<Either<SqliteQueryResult, SqliteRow>, Error>>
where
't: 'e,
E: Execute<'q, Sqlite>,
E: Execute<'q, Sqlite> + 'q,
{
self.0.fetch_many(query)
}

fn fetch_optional<'e, 'q: 'e, E: 'q>(
fn fetch_optional<'e, 'q: 'e, E>(
self,
query: E,
) -> BoxFuture<'e, Result<Option<SqliteRow>, Error>>
where
't: 'e,
E: Execute<'q, Sqlite>,
E: Execute<'q, Sqlite> + 'q,
{
self.0.fetch_optional(query)
}
Expand Down
8 changes: 4 additions & 4 deletions lib/src/db/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ macro_rules! impl_executor_by_deref {
impl<'t> sqlx::Executor<'t> for &'t mut $type {
type Database = sqlx::Sqlite;

fn fetch_many<'e, 'q: 'e, E: 'q>(
fn fetch_many<'e, 'q: 'e, E>(
self,
query: E,
) -> futures_util::stream::BoxStream<
Expand All @@ -16,12 +16,12 @@ macro_rules! impl_executor_by_deref {
>
where
't: 'e,
E: sqlx::Execute<'q, sqlx::Sqlite>,
E: sqlx::Execute<'q, sqlx::Sqlite> + 'q,
{
(&mut **self).fetch_many(query)
}

fn fetch_optional<'e, 'q: 'e, E: 'q>(
fn fetch_optional<'e, 'q: 'e, E>(
self,
query: E,
) -> futures_util::future::BoxFuture<
Expand All @@ -30,7 +30,7 @@ macro_rules! impl_executor_by_deref {
>
where
't: 'e,
E: sqlx::Execute<'q, sqlx::Sqlite>,
E: sqlx::Execute<'q, sqlx::Sqlite> + 'q,
{
(&mut **self).fetch_optional(query)
}
Expand Down
3 changes: 3 additions & 0 deletions lib/src/iterator/combinations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/// repetition.
///
/// Example: [1, 2, 3] -> [(1, 2), (1, 3), (2, 3)]
#[cfg(test)]
pub(crate) struct PairCombinations<I>
where
I: Iterator,
Expand All @@ -11,6 +12,7 @@ where
b_iter: I,
}

#[cfg(test)]
impl<I> PairCombinations<I>
where
I: Iterator + Clone,
Expand All @@ -32,6 +34,7 @@ where
}
}

#[cfg(test)]
impl<I> Iterator for PairCombinations<I>
where
I: Iterator + Clone,
Expand Down
25 changes: 0 additions & 25 deletions lib/src/iterator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ mod accumulate;
mod combinations;
mod sorted_union;

use crate::collections::{hash_set, HashSet};
use std::hash::Hash;

#[cfg(test)]
pub(crate) use self::combinations::PairCombinations;
pub(crate) use self::{accumulate::Accumulate, sorted_union::SortedUnion};
Expand Down Expand Up @@ -37,28 +34,6 @@ where
true
}

/// Owned version of `HashSet::intersection`
pub(crate) struct IntoIntersection<T> {
iter: hash_set::IntoIter<T>,
other: HashSet<T>,
}

impl<T> Iterator for IntoIntersection<T>
where
T: Eq + Hash,
{
type Item = T;

fn next(&mut self) -> Option<Self::Item> {
loop {
let e = self.iter.next()?;
if self.other.contains(&e) {
return Some(e);
}
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
7 changes: 0 additions & 7 deletions lib/src/network/message_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,6 @@ impl ContentStreamTrait for ContentStream {
#[derive(Debug)]
pub(super) struct ChannelClosed;

/// Live* collection of active connections of a `MessageDispatcher`.
///
/// *) It means it gets automatically updated as connections are added/removed to/from the
/// dispatcher.
#[derive(Clone)]
pub(super) struct LiveConnectionInfoSet {}

struct ChannelQueue {
reference_count: usize,
rx: Arc<AsyncMutex<ChannelQueueReceiver>>,
Expand Down
9 changes: 0 additions & 9 deletions net/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ pub(crate) trait Socket: Sized {
const RAW_TYPE: socket2::Type;

fn from_raw(raw: socket2::Socket) -> io::Result<Self>;
fn local_addr(&self) -> io::Result<SocketAddr>;
}

impl Socket for TcpListener {
Expand All @@ -76,10 +75,6 @@ impl Socket for TcpListener {

TcpListener::from_std(raw.into())
}

fn local_addr(&self) -> io::Result<SocketAddr> {
TcpListener::local_addr(self)
}
}

impl Socket for UdpSocket {
Expand All @@ -88,8 +83,4 @@ impl Socket for UdpSocket {
fn from_raw(raw: socket2::Socket) -> io::Result<Self> {
UdpSocket::from_std(raw.into())
}

fn local_addr(&self) -> io::Result<SocketAddr> {
UdpSocket::local_addr(self)
}
}

0 comments on commit e71c4bf

Please sign in to comment.