Skip to content

Commit

Permalink
fmt and clippy with updated rust
Browse files Browse the repository at this point in the history
  • Loading branch information
zommiommy committed Dec 13, 2024
1 parent c0b6330 commit e8b0012
Show file tree
Hide file tree
Showing 25 changed files with 209 additions and 138 deletions.
6 changes: 4 additions & 2 deletions examples/bench_swh_labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ pub struct MmapReaderSupplier<E: Endianness> {
}

impl Supply for MmapReaderSupplier<BE> {
type Item<'a> = BufBitReader<BE, MemWordReader<u32, &'a [u32]>>
where Self: 'a;
type Item<'a>
= BufBitReader<BE, MemWordReader<u32, &'a [u32]>>
where
Self: 'a;

fn request(&self) -> Self::Item<'_> {
BufBitReader::<BE, _>::new(MemWordReader::new(self.backend.as_ref()))
Expand Down
6 changes: 3 additions & 3 deletions src/algo/bfs_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct BfsOrder<'a, G: RandomAccessGraph> {
start: usize,
}

impl<'a, G: RandomAccessGraph> BfsOrder<'a, G> {
impl<G: RandomAccessGraph> BfsOrder<'_, G> {
pub fn new(graph: &G) -> BfsOrder<G> {
let num_nodes = graph.num_nodes();
let mut pl = ProgressLogger::default();
Expand All @@ -41,7 +41,7 @@ impl<'a, G: RandomAccessGraph> BfsOrder<'a, G> {
}
}

impl<'a, G: RandomAccessGraph> Iterator for BfsOrder<'a, G> {
impl<G: RandomAccessGraph> Iterator for BfsOrder<'_, G> {
type Item = usize;

fn next(&mut self) -> Option<usize> {
Expand Down Expand Up @@ -72,7 +72,7 @@ impl<'a, G: RandomAccessGraph> Iterator for BfsOrder<'a, G> {
}
}

impl<'a, G: RandomAccessGraph> ExactSizeIterator for BfsOrder<'a, G> {
impl<G: RandomAccessGraph> ExactSizeIterator for BfsOrder<'_, G> {
fn len(&self) -> usize {
self.graph.num_nodes()
}
Expand Down
19 changes: 14 additions & 5 deletions src/graphs/arc_list_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ where
<I as std::iter::IntoIterator>::IntoIter: Clone + Send + Sync,
L: Send + Sync,
{
type SplitLender<'a> = split::seq::Lender<'a, ArcListGraph<I>> where Self: 'a;
type IntoIterator<'a> = split::seq::IntoIterator<'a, ArcListGraph<I>> where Self: 'a;
type SplitLender<'a>
= split::seq::Lender<'a, ArcListGraph<I>>
where
Self: 'a;
type IntoIterator<'a>
= split::seq::IntoIterator<'a, ArcListGraph<I>>
where
Self: 'a;

fn split_iter(&self, how_many: usize) -> Self::IntoIterator<'_> {
split::seq::Iter::new(self.iter(), self.num_nodes(), how_many)
Expand Down Expand Up @@ -149,7 +155,10 @@ impl<L: Clone + 'static, I: IntoIterator<Item = (usize, usize, L)> + Clone> Sequ
for ArcListGraph<I>
{
type Label = (usize, L);
type Lender<'node> = Iter<L, I> where Self: 'node;
type Lender<'node>
= Iter<L, I>
where
Self: 'node;

#[inline(always)]
fn num_nodes(&self) -> usize {
Expand Down Expand Up @@ -177,12 +186,12 @@ pub struct Succ<'succ, L, I: IntoIterator<Item = (usize, usize, L)>> {
node_iter: &'succ mut Iter<L, I>,
}

unsafe impl<'a, L, I: IntoIterator<Item = (usize, usize, L)>> SortedIterator for Succ<'a, L, I> where
unsafe impl<L, I: IntoIterator<Item = (usize, usize, L)>> SortedIterator for Succ<'_, L, I> where
I::IntoIter: SortedIterator
{
}

impl<'a, L, I: IntoIterator<Item = (usize, usize, L)>> Iterator for Succ<'a, L, I> {
impl<L, I: IntoIterator<Item = (usize, usize, L)>> Iterator for Succ<'_, L, I> {
type Item = (usize, L);
fn next(&mut self) -> Option<Self::Item> {
// If the source of the next pair is not the current node,
Expand Down
8 changes: 4 additions & 4 deletions src/graphs/bvgraph/codecs/dec_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ impl<
where
for<'a> <F as BitReaderFactory<E>>::BitReader<'a>: CodeRead<E> + BitSeek,
{
type Decoder<'a> =
ConstCodesDecoder<E, <F as BitReaderFactory<E>>::BitReader<'a>>
type Decoder<'a>
= ConstCodesDecoder<E, <F as BitReaderFactory<E>>::BitReader<'a>>
where
Self: 'a;

Expand Down Expand Up @@ -344,8 +344,8 @@ impl<
where
for<'a> <F as BitReaderFactory<E>>::BitReader<'a>: CodeRead<E>,
{
type Decoder<'a> =
ConstCodesDecoder<E, <F as BitReaderFactory<E>>::BitReader<'a>>
type Decoder<'a>
= ConstCodesDecoder<E, <F as BitReaderFactory<E>>::BitReader<'a>>
where
Self: 'a;

Expand Down
8 changes: 4 additions & 4 deletions src/graphs/bvgraph/codecs/dec_dyn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ impl<E: Endianness, F: BitReaderFactory<E>, OFF: IndexedSeq<Input = usize, Outpu
where
for<'a> <F as BitReaderFactory<E>>::BitReader<'a>: CodeRead<E> + BitSeek,
{
type Decoder<'a> =
DynCodesDecoder<E, <F as BitReaderFactory<E>>::BitReader<'a>>
type Decoder<'a>
= DynCodesDecoder<E, <F as BitReaderFactory<E>>::BitReader<'a>>
where
Self: 'a;

Expand Down Expand Up @@ -326,8 +326,8 @@ impl<E: Endianness, F: BitReaderFactory<E>> SequentialDecoderFactory
where
for<'a> <F as BitReaderFactory<E>>::BitReader<'a>: CodeRead<E>,
{
type Decoder<'a> =
DynCodesDecoder<E, <F as BitReaderFactory<E>>::BitReader<'a>>
type Decoder<'a>
= DynCodesDecoder<E, <F as BitReaderFactory<E>>::BitReader<'a>>
where
Self: 'a;

Expand Down
9 changes: 5 additions & 4 deletions src/graphs/bvgraph/codecs/dec_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ impl<F> SequentialDecoderFactory for StatsDecoderFactory<F>
where
F: SequentialDecoderFactory,
{
type Decoder<'a> = StatsDecoder<'a, F>
type Decoder<'a>
= StatsDecoder<'a, F>
where
Self: 'a;

Expand All @@ -108,7 +109,7 @@ pub struct StatsDecoder<'a, F: SequentialDecoderFactory> {
stats: DecoderStats,
}

impl<'a, F: SequentialDecoderFactory> Drop for StatsDecoder<'a, F> {
impl<F: SequentialDecoderFactory> Drop for StatsDecoder<'_, F> {
fn drop(&mut self) {
self.factory.glob_stats.lock().unwrap().update(&self.stats);
}
Expand All @@ -130,7 +131,7 @@ impl<'a, F: SequentialDecoderFactory> StatsDecoder<'a, F> {
}
}

impl<'a, F: SequentialDecoderFactory> Decode for StatsDecoder<'a, F> {
impl<F: SequentialDecoderFactory> Decode for StatsDecoder<'_, F> {
#[inline(always)]
fn read_outdegree(&mut self) -> u64 {
self.stats
Expand Down Expand Up @@ -184,8 +185,8 @@ impl<'a, F: SequentialDecoderFactory> Decode for StatsDecoder<'a, F> {
.first_residuals
.update(self.codes_reader.read_first_residual())
}
#[inline(always)]

#[inline(always)]
fn read_residual(&mut self) -> u64 {
self.stats
.residuals
Expand Down
6 changes: 4 additions & 2 deletions src/graphs/bvgraph/codecs/enc_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ impl<
> EncodeAndEstimate
for ConstCodesEncoder<E, CW, OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS, K>
{
type Estimator<'a> = ConstCodesEstimator<OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS, K>
where Self: 'a;
type Estimator<'a>
= ConstCodesEstimator<OUTDEGREES, REFERENCES, BLOCKS, INTERVALS, RESIDUALS, K>
where
Self: 'a;
fn estimator(&mut self) -> Self::Estimator<'_> {
ConstCodesEstimator::new()
}
Expand Down
6 changes: 4 additions & 2 deletions src/graphs/bvgraph/codecs/enc_dyn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ impl<E: Endianness, CW: CodeWrite<E>> EncodeAndEstimate for DynCodesEncoder<E, C
where
<CW as BitWrite<E>>::Error: Send + Sync,
{
type Estimator<'a> = &'a mut DynCodesEstimator
where Self: 'a;
type Estimator<'a>
= &'a mut DynCodesEstimator
where
Self: 'a;

fn estimator(&mut self) -> Self::Estimator<'_> {
&mut self.estimator
Expand Down
6 changes: 4 additions & 2 deletions src/graphs/bvgraph/codecs/factories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ impl<E: Endianness> FileFactory<E> {
}

impl<E: Endianness> BitReaderFactory<E> for FileFactory<E> {
type BitReader<'a> = BufBitReader<E, WordAdapter<u32, BufReader<File>>>
type BitReader<'a>
= BufBitReader<E, WordAdapter<u32, BufReader<File>>>
where
Self: 'a;

Expand Down Expand Up @@ -229,7 +230,8 @@ impl<E: Endianness> MemoryFactory<E, MmapHelper<u32>> {
}

impl<E: Endianness, M: AsRef<[u32]>> BitReaderFactory<E> for MemoryFactory<E, M> {
type BitReader<'a> = BufBitReader<E, MemWordReader<u32, &'a[u32]>>
type BitReader<'a>
= BufBitReader<E, MemWordReader<u32, &'a [u32]>>
where
Self: 'a;

Expand Down
20 changes: 15 additions & 5 deletions src/graphs/bvgraph/random_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,14 @@ impl<F: RandomAccessDecoderFactory> SplitLabeling for BvGraph<F>
where
for<'a> <F as RandomAccessDecoderFactory>::Decoder<'a>: Send + Sync,
{
type SplitLender<'a> = split::ra::Lender<'a, BvGraph<F>> where Self: 'a;
type IntoIterator<'a> = split::ra::IntoIterator<'a, BvGraph<F>> where Self: 'a;
type SplitLender<'a>
= split::ra::Lender<'a, BvGraph<F>>
where
Self: 'a;
type IntoIterator<'a>
= split::ra::IntoIterator<'a, BvGraph<F>>
where
Self: 'a;

fn split_iter(&self, how_many: usize) -> Self::IntoIterator<'_> {
split::ra::Iter::new(self, how_many)
Expand Down Expand Up @@ -146,7 +152,8 @@ where
F: RandomAccessDecoderFactory,
{
type Label = usize;
type Lender<'b> = Iter<F::Decoder<'b>>
type Lender<'b>
= Iter<F::Decoder<'b>>
where
Self: 'b,
F: 'b;
Expand Down Expand Up @@ -188,8 +195,11 @@ impl<F> RandomAccessLabeling for BvGraph<F>
where
F: RandomAccessDecoderFactory,
{
type Labels<'a> = Succ<F::Decoder<'a>>
where Self: 'a, F: 'a;
type Labels<'a>
= Succ<F::Decoder<'a>>
where
Self: 'a,
F: 'a;

fn num_arcs(&self) -> u64 {
self.number_of_arcs
Expand Down
13 changes: 10 additions & 3 deletions src/graphs/bvgraph/sequential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ impl<F: SequentialDecoderFactory> SplitLabeling for BvGraphSeq<F>
where
for<'a> <F as SequentialDecoderFactory>::Decoder<'a>: Clone + Send + Sync,
{
type SplitLender<'a> = split::seq::Lender<'a, BvGraphSeq<F>> where Self: 'a;
type IntoIterator<'a> = split::seq::IntoIterator<'a, BvGraphSeq<F>> where Self: 'a;
type SplitLender<'a>
= split::seq::Lender<'a, BvGraphSeq<F>>
where
Self: 'a;
type IntoIterator<'a>
= split::seq::IntoIterator<'a, BvGraphSeq<F>>
where
Self: 'a;

fn split_iter(&self, how_many: usize) -> Self::IntoIterator<'_> {
split::seq::Iter::new(self.iter(), self.num_nodes(), how_many)
Expand All @@ -55,7 +61,8 @@ where

impl<F: SequentialDecoderFactory> SequentialLabeling for BvGraphSeq<F> {
type Label = usize;
type Lender<'a> = Iter<F::Decoder<'a>>
type Lender<'a>
= Iter<F::Decoder<'a>>
where
Self: 'a;

Expand Down
17 changes: 12 additions & 5 deletions src/graphs/no_selfloops_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ pub struct NoSelfLoopsGraph<G>(pub G);

impl<G: SequentialGraph> SequentialLabeling for NoSelfLoopsGraph<G> {
type Label = usize;
type Lender<'b> = Iter<G::Lender<'b>>
where
Self: 'b;
type Lender<'b>
= Iter<G::Lender<'b>>
where
Self: 'b;

#[inline(always)]
fn num_nodes(&self) -> usize {
Expand All @@ -42,8 +43,14 @@ impl<G: SequentialGraph + SplitLabeling> SplitLabeling for NoSelfLoopsGraph<G>
where
for<'a> <G as SequentialLabeling>::Lender<'a>: Clone + Send + Sync,
{
type SplitLender<'a> = split::seq::Lender<'a, NoSelfLoopsGraph<G> > where Self: 'a;
type IntoIterator<'a> = split::seq::IntoIterator<'a, NoSelfLoopsGraph<G>> where Self: 'a;
type SplitLender<'a>
= split::seq::Lender<'a, NoSelfLoopsGraph<G>>
where
Self: 'a;
type IntoIterator<'a>
= split::seq::IntoIterator<'a, NoSelfLoopsGraph<G>>
where
Self: 'a;

fn split_iter(&self, how_many: usize) -> Self::IntoIterator<'_> {
split::seq::Iter::new(self.iter(), self.num_nodes(), how_many)
Expand Down
Loading

0 comments on commit e8b0012

Please sign in to comment.