Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
regexident committed Dec 2, 2024
1 parent 3643e41 commit 81432a0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
4 changes: 2 additions & 2 deletions crates/builder/src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ mod tests {
}
}

impl<'a> PartialEq for Foo<'a> {
impl PartialEq for Foo<'_> {
fn eq(&self, other: &Self) -> bool {
self.i.eq(&other.i)
}
}

impl<'a> Drop for Foo<'a> {
impl Drop for Foo<'_> {
fn drop(&mut self) {
self.c.fetch_add(1, atomic::Ordering::SeqCst);
}
Expand Down
31 changes: 23 additions & 8 deletions crates/builder/src/graph/csr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ struct ToUndirectedEdges<'g, NI: Idx, NV, EV> {
g: &'g DirectedCsrGraph<NI, NV, EV>,
}

impl<'g, NI, NV, EV> Edges for ToUndirectedEdges<'g, NI, NV, EV>
impl<NI, NV, EV> Edges for ToUndirectedEdges<'_, NI, NV, EV>
where
NI: Idx,
NV: Send + Sync,
Expand All @@ -419,7 +419,8 @@ where

type EV = EV;

type EdgeIter<'a> = ToUndirectedEdgesIter<'a, NI, NV, EV>
type EdgeIter<'a>
= ToUndirectedEdgesIter<'a, NI, NV, EV>
where
Self: 'a;

Expand All @@ -441,8 +442,8 @@ struct ToUndirectedEdgesIter<'g, NI: Idx, NV, EV> {
g: &'g DirectedCsrGraph<NI, NV, EV>,
}

impl<'g, NI: Idx, NV: Send + Sync, EV: Copy + Send + Sync> ParallelIterator
for ToUndirectedEdgesIter<'g, NI, NV, EV>
impl<NI: Idx, NV: Send + Sync, EV: Copy + Send + Sync> ParallelIterator
for ToUndirectedEdgesIter<'_, NI, NV, EV>
{
type Item = (NI, NI, EV);

Expand Down Expand Up @@ -488,7 +489,10 @@ impl<NI: Idx, NV, EV> DirectedDegrees<NI> for DirectedCsrGraph<NI, NV, EV> {
}

impl<NI: Idx, NV> DirectedNeighbors<NI> for DirectedCsrGraph<NI, NV, ()> {
type NeighborsIterator<'a> = std::slice::Iter<'a, NI> where NV: 'a;
type NeighborsIterator<'a>
= std::slice::Iter<'a, NI>
where
NV: 'a;

fn out_neighbors(&self, node: NI) -> Self::NeighborsIterator<'_> {
self.csr_out.targets(node).iter()
Expand All @@ -500,7 +504,11 @@ impl<NI: Idx, NV> DirectedNeighbors<NI> for DirectedCsrGraph<NI, NV, ()> {
}

impl<NI: Idx, NV, EV> DirectedNeighborsWithValues<NI, EV> for DirectedCsrGraph<NI, NV, EV> {
type NeighborsIterator<'a> = std::slice::Iter<'a, Target<NI, EV>> where NV:'a, EV: 'a;
type NeighborsIterator<'a>
= std::slice::Iter<'a, Target<NI, EV>>
where
NV: 'a,
EV: 'a;

fn out_neighbors_with_values(&self, node: NI) -> Self::NeighborsIterator<'_> {
self.csr_out.targets_with_values(node).iter()
Expand Down Expand Up @@ -694,15 +702,22 @@ impl<NI: Idx, NV, EV> UndirectedDegrees<NI> for UndirectedCsrGraph<NI, NV, EV> {
}

impl<NI: Idx, NV> UndirectedNeighbors<NI> for UndirectedCsrGraph<NI, NV> {
type NeighborsIterator<'a> = std::slice::Iter<'a, NI> where NV: 'a;
type NeighborsIterator<'a>
= std::slice::Iter<'a, NI>
where
NV: 'a;

fn neighbors(&self, node: NI) -> Self::NeighborsIterator<'_> {
self.csr.targets(node).iter()
}
}

impl<NI: Idx, NV, EV> UndirectedNeighborsWithValues<NI, EV> for UndirectedCsrGraph<NI, NV, EV> {
type NeighborsIterator<'a> = std::slice::Iter<'a, Target<NI, EV>> where NV: 'a, EV: 'a;
type NeighborsIterator<'a>
= std::slice::Iter<'a, Target<NI, EV>>
where
NV: 'a,
EV: 'a;

fn neighbors_with_values(&self, node: NI) -> Self::NeighborsIterator<'_> {
self.csr.targets_with_values(node).iter()
Expand Down
2 changes: 1 addition & 1 deletion crates/builder/src/graph_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub trait ToUndirectedOp {
///
/// This method accepts an optional [`CsrLayout`] as second parameter,
/// which has the same effect as described in [`GraphBuilder::csr_layout`]
///
/// # Example
///
/// ```
Expand Down
2 changes: 1 addition & 1 deletion crates/builder/src/input/gdl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::hash::Hash;
/// A wrapper around [`gdl::CypherValue`] to allow custom From implementations.
pub struct MyCypherValue<'a>(&'a CypherValue);

impl<'a> From<MyCypherValue<'a>> for () {
impl From<MyCypherValue<'_>> for () {
fn from(_: MyCypherValue) -> Self {}
}

Expand Down
7 changes: 4 additions & 3 deletions crates/mate/src/graphs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ impl<'a, T> ArrayEdgeList<'a, T> {

struct ArrayRows<'a, T>(AxisIter<'a, T, Ix1>);

impl<'a, T: Copy + Debug> Iterator for ArrayRows<'a, T> {
impl<T: Copy + Debug> Iterator for ArrayRows<'_, T> {
type Item = (T, T, ());

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -459,12 +459,13 @@ impl<'a, T: Copy + Debug> Iterator for ArrayRows<'a, T> {
}
}

impl<'outer, T: Idx> Edges for ArrayEdgeList<'outer, T> {
impl<T: Idx> Edges for ArrayEdgeList<'_, T> {
type NI = T;

type EV = ();

type EdgeIter<'a> = rayon::iter::IterBridge<ArrayRows<'a, T>>
type EdgeIter<'a>
= rayon::iter::IterBridge<ArrayRows<'a, T>>
where
Self: 'a;

Expand Down

0 comments on commit 81432a0

Please sign in to comment.