diff --git a/webgraph/Cargo.toml b/webgraph/Cargo.toml index 6a9238e3..85254669 100644 --- a/webgraph/Cargo.toml +++ b/webgraph/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "webgraph" version = "0.4.0" -edition = "2021" +edition = "2024" description = "A Rust port of the WebGraph framework (http://webgraph.di.unimi.it/)." repository = "https://github.com/vigna/webgraph-rs/" license = "Apache-2.0 OR LGPL-2.1-or-later" diff --git a/webgraph/examples/bench_sort_pairs.rs b/webgraph/examples/bench_sort_pairs.rs index b0041498..24e87176 100644 --- a/webgraph/examples/bench_sort_pairs.rs +++ b/webgraph/examples/bench_sort_pairs.rs @@ -11,11 +11,11 @@ use anyhow::Result; use clap::Parser; use dsi_bitstream::traits::BitRead; use dsi_bitstream::traits::BitWrite; -use dsi_bitstream::traits::{Endianness, BE}; +use dsi_bitstream::traits::{BE, Endianness}; use dsi_progress_logger::prelude::{ProgressLog, ProgressLogger}; -use rand::rngs::SmallRng; use rand::RngCore; use rand::SeedableRng; +use rand::rngs::SmallRng; use tempfile::Builder; use webgraph::prelude::*; use webgraph::utils::gaps::GapsCodec; diff --git a/webgraph/examples/bench_swh_labels.rs b/webgraph/examples/bench_swh_labels.rs index 23f03bdf..b2b1ee2a 100644 --- a/webgraph/examples/bench_swh_labels.rs +++ b/webgraph/examples/bench_swh_labels.rs @@ -10,7 +10,7 @@ use bitstream::Supply; use clap::Parser; use dsi_bitstream::codes::GammaRead; use dsi_bitstream::impls::{BufBitReader, MemWordReader}; -use dsi_bitstream::traits::{BitRead, BitSeek, Endianness, BE}; +use dsi_bitstream::traits::{BE, BitRead, BitSeek, Endianness}; use dsi_progress_logger::prelude::*; use epserde::deser::{Deserialize, Flags}; use lender::*; diff --git a/webgraph/src/graphs/arc_list_graph.rs b/webgraph/src/graphs/arc_list_graph.rs index eb8d7e08..b87d0460 100644 --- a/webgraph/src/graphs/arc_list_graph.rs +++ b/webgraph/src/graphs/arc_list_graph.rs @@ -5,7 +5,7 @@ */ use crate::{labels::Left, traits::*}; -use anyhow::{ensure, Result}; +use anyhow::{Result, ensure}; use lender::*; /// An adapter exhibiting a list of labeled arcs sorted by source as a [labeled @@ -108,7 +108,10 @@ impl> Iter { pub fn try_new_from(num_nodes: usize, iter: I, from: usize) -> Result { let mut iter = iter.peekable(); if let Some(((first_src, _), _)) = iter.peek() { - ensure!(*first_src >= from, "Tried to create arc_list_graph::Iter starting from {from} using an iterator starting from {first_src}"); + ensure!( + *first_src >= from, + "Tried to create arc_list_graph::Iter starting from {from} using an iterator starting from {first_src}" + ); } Ok(Iter { num_nodes: num_nodes + from, @@ -222,7 +225,7 @@ impl> Iterator for Succ<'_, L, I> type Item = (usize, L); fn next(&mut self) -> Option { // If the next pair is not there, or it has a different source, we are done - if self.node_iter.iter.peek()?.0 .0 >= self.node_iter.next_node { + if self.node_iter.iter.peek()?.0.0 >= self.node_iter.next_node { return None; } // get the next labeled pair diff --git a/webgraph/src/graphs/bvgraph/codecs/dec_const.rs b/webgraph/src/graphs/bvgraph/codecs/dec_const.rs index d842eb7a..2f062014 100644 --- a/webgraph/src/graphs/bvgraph/codecs/dec_const.rs +++ b/webgraph/src/graphs/bvgraph/codecs/dec_const.rs @@ -8,8 +8,8 @@ use std::marker::PhantomData; use super::super::*; -use anyhow::bail; use anyhow::Result; +use anyhow::bail; use dsi_bitstream::dispatch::code_consts; use dsi_bitstream::dispatch::factory::CodesReaderFactoryHelper; use dsi_bitstream::prelude::*; @@ -38,14 +38,14 @@ pub struct ConstCodesDecoder< } impl< - E: Endianness, - CR: CodesRead + BitSeek, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > BitSeek for ConstCodesDecoder + E: Endianness, + CR: CodesRead + BitSeek, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> BitSeek for ConstCodesDecoder { type Error = ::Error; @@ -59,14 +59,14 @@ impl< } impl< - E: Endianness, - CR: CodesRead, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > ConstCodesDecoder + E: Endianness, + CR: CodesRead, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> ConstCodesDecoder { /// Creates a new [`ConstCodesEncoder`] from a [`CodesRead`] implementation. /// and a [`CompFlags`] struct @@ -96,14 +96,14 @@ impl< } impl< - E: Endianness, - CR: CodesRead, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > Decode for ConstCodesDecoder + E: Endianness, + CR: CodesRead, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> Decode for ConstCodesDecoder { #[inline(always)] fn read_outdegree(&mut self) -> u64 { @@ -167,15 +167,15 @@ pub struct ConstCodesDecoderFactory< } impl< - E: Endianness, - F: CodesReaderFactoryHelper, - OFF: Offsets, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > ConstCodesDecoderFactory + E: Endianness, + F: CodesReaderFactoryHelper, + OFF: Offsets, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> ConstCodesDecoderFactory { /// Remaps the offsets in a slice of `usize`. /// @@ -210,15 +210,15 @@ impl< } impl< - E: Endianness, - F: CodesReaderFactoryHelper, - OFF: Offsets, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > ConstCodesDecoderFactory + E: Endianness, + F: CodesReaderFactoryHelper, + OFF: Offsets, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> ConstCodesDecoderFactory { /// Creates a new builder from the given data and compression flags. pub fn new(factory: F, offsets: MemCase, comp_flags: CompFlags) -> anyhow::Result { @@ -246,15 +246,15 @@ impl< } impl< - E: Endianness, - F: CodesReaderFactoryHelper, - OFF: Offsets, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > RandomAccessDecoderFactory + E: Endianness, + F: CodesReaderFactoryHelper, + OFF: Offsets, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> RandomAccessDecoderFactory for ConstCodesDecoderFactory where for<'a> >::CodesReader<'a>: BitSeek, @@ -276,15 +276,15 @@ where } impl< - E: Endianness, - F: CodesReaderFactoryHelper, - OFF: Offsets, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > SequentialDecoderFactory + E: Endianness, + F: CodesReaderFactoryHelper, + OFF: Offsets, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> SequentialDecoderFactory for ConstCodesDecoderFactory { type Decoder<'a> diff --git a/webgraph/src/graphs/bvgraph/codecs/dec_dyn.rs b/webgraph/src/graphs/bvgraph/codecs/dec_dyn.rs index 16f223d5..a29d76d4 100644 --- a/webgraph/src/graphs/bvgraph/codecs/dec_dyn.rs +++ b/webgraph/src/graphs/bvgraph/codecs/dec_dyn.rs @@ -9,8 +9,8 @@ use std::marker::PhantomData; use super::super::*; -use dsi_bitstream::dispatch::factory::CodesReaderFactoryHelper; use dsi_bitstream::dispatch::CodesReaderFactory; +use dsi_bitstream::dispatch::factory::CodesReaderFactoryHelper; use dsi_bitstream::prelude::*; use epserde::deser::{MemCase, Owned}; diff --git a/webgraph/src/graphs/bvgraph/codecs/enc_const.rs b/webgraph/src/graphs/bvgraph/codecs/enc_const.rs index 852235a5..c30f0155 100644 --- a/webgraph/src/graphs/bvgraph/codecs/enc_const.rs +++ b/webgraph/src/graphs/bvgraph/codecs/enc_const.rs @@ -28,14 +28,14 @@ pub struct ConstCodesEncoder< } impl< - E: Endianness, - CW: CodesWrite + BitSeek, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > BitSeek for ConstCodesEncoder + E: Endianness, + CW: CodesWrite + BitSeek, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> BitSeek for ConstCodesEncoder { type Error = ::Error; @@ -49,14 +49,14 @@ impl< } impl< - E: Endianness, - CW: CodesWrite, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > ConstCodesEncoder + E: Endianness, + CW: CodesWrite, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> ConstCodesEncoder { /// Creates a new [`ConstCodesEncoder`] with the given [`CodesWrite`] implementation. pub fn new(code_writer: CW) -> Self { @@ -68,14 +68,14 @@ impl< } impl< - E: Endianness, - CW: CodesWrite, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > Encode for ConstCodesEncoder + E: Endianness, + CW: CodesWrite, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> Encode for ConstCodesEncoder { type Error = >::Error; @@ -136,14 +136,14 @@ impl< } impl< - E: Endianness, - CW: CodesWrite, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > EncodeAndEstimate + E: Endianness, + CW: CodesWrite, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> EncodeAndEstimate for ConstCodesEncoder { type Estimator<'a> @@ -166,12 +166,12 @@ pub struct ConstCodesEstimator< >; impl< - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > ConstCodesEstimator + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> ConstCodesEstimator { pub fn new() -> Self { Self @@ -179,12 +179,12 @@ impl< } impl< - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > Encode for ConstCodesEstimator + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> Encode for ConstCodesEstimator { type Error = Infallible; diff --git a/webgraph/src/graphs/bvgraph/codecs/factories.rs b/webgraph/src/graphs/bvgraph/codecs/factories.rs index a0fa8795..08012a52 100644 --- a/webgraph/src/graphs/bvgraph/codecs/factories.rs +++ b/webgraph/src/graphs/bvgraph/codecs/factories.rs @@ -27,7 +27,7 @@ use crate::{ prelude::{FileBufReader, MemBufReader}, utils::MmapHelper, }; -use anyhow::{ensure, Context}; +use anyhow::{Context, ensure}; use bitflags::bitflags; use common_traits::UnsignedInt; use dsi_bitstream::{ diff --git a/webgraph/src/graphs/bvgraph/comp/flags.rs b/webgraph/src/graphs/bvgraph/comp/flags.rs index b0d19aff..17cfc6d7 100644 --- a/webgraph/src/graphs/bvgraph/comp/flags.rs +++ b/webgraph/src/graphs/bvgraph/comp/flags.rs @@ -5,7 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later */ -use anyhow::{bail, ensure, Result}; +use anyhow::{Result, bail, ensure}; use dsi_bitstream::dispatch::Codes; use dsi_bitstream::traits::{BigEndian, Endianness, LittleEndian}; use std::collections::HashMap; diff --git a/webgraph/src/graphs/bvgraph/comp/impls.rs b/webgraph/src/graphs/bvgraph/comp/impls.rs index c0dd2fac..34f8e1df 100644 --- a/webgraph/src/graphs/bvgraph/comp/impls.rs +++ b/webgraph/src/graphs/bvgraph/comp/impls.rs @@ -6,7 +6,7 @@ */ use crate::prelude::*; -use anyhow::{ensure, Context, Result}; +use anyhow::{Context, Result, ensure}; use dsi_bitstream::prelude::*; use dsi_progress_logger::prelude::*; use lender::prelude::*; diff --git a/webgraph/src/graphs/bvgraph/load.rs b/webgraph/src/graphs/bvgraph/load.rs index fd215a78..b5ffbce8 100644 --- a/webgraph/src/graphs/bvgraph/load.rs +++ b/webgraph/src/graphs/bvgraph/load.rs @@ -52,12 +52,12 @@ pub struct Static< #[sealed] impl< - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > Dispatch for Static + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> Dispatch for Static { } @@ -455,16 +455,15 @@ impl LoadConfig - LoadConfig, GLM, OLM> + E: Endianness, + GLM: LoadMode, + OLM: LoadMode, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> LoadConfig, GLM, OLM> { /// Load a random-access graph with static dispatch. pub fn load( @@ -505,15 +504,15 @@ impl< } impl< - E: Endianness, - GLM: LoadMode, - OLM: LoadMode, - const OUTDEGREES: usize, - const REFERENCES: usize, - const BLOCKS: usize, - const INTERVALS: usize, - const RESIDUALS: usize, - > + E: Endianness, + GLM: LoadMode, + OLM: LoadMode, + const OUTDEGREES: usize, + const REFERENCES: usize, + const BLOCKS: usize, + const INTERVALS: usize, + const RESIDUALS: usize, +> LoadConfig< E, Sequential, diff --git a/webgraph/src/graphs/bvgraph/random_access.rs b/webgraph/src/graphs/bvgraph/random_access.rs index 2c2bb7d8..27b69e90 100644 --- a/webgraph/src/graphs/bvgraph/random_access.rs +++ b/webgraph/src/graphs/bvgraph/random_access.rs @@ -9,7 +9,7 @@ use crate::prelude::*; use bitflags::Flags; use dsi_bitstream::codes::ToInt; use dsi_bitstream::dispatch::factory::CodesReaderFactoryHelper; -use dsi_bitstream::traits::{Endianness, BE}; +use dsi_bitstream::traits::{BE, Endianness}; use epserde::deser::Owned; use lender::IntoLender; use std::path::PathBuf; diff --git a/webgraph/src/graphs/bvgraph/sequential.rs b/webgraph/src/graphs/bvgraph/sequential.rs index 68bbc0d3..a7cc1ac8 100644 --- a/webgraph/src/graphs/bvgraph/sequential.rs +++ b/webgraph/src/graphs/bvgraph/sequential.rs @@ -12,8 +12,8 @@ use crate::utils::CircularBuffer; use anyhow::Result; use bitflags::Flags; use dsi_bitstream::codes::ToInt; -use dsi_bitstream::traits::BitSeek; use dsi_bitstream::traits::BE; +use dsi_bitstream::traits::BitSeek; use lender::*; /// A sequential BvGraph that can be read from a `codes_reader_builder`. diff --git a/webgraph/src/graphs/csr_graph.rs b/webgraph/src/graphs/csr_graph.rs index 863deae6..a026483c 100644 --- a/webgraph/src/graphs/csr_graph.rs +++ b/webgraph/src/graphs/csr_graph.rs @@ -9,7 +9,7 @@ use super::bvgraph::EF; use crate::traits::*; use common_traits::UnsignedInt; use epserde::Epserde; -use lender::{for_, IntoLender, Lend, Lender, Lending}; +use lender::{IntoLender, Lend, Lender, Lending, for_}; use sux::{bits::BitFieldVec, dict::EliasFanoBuilder, prelude::SelectAdaptConst}; use value_traits::{ iter::{IterFrom, IterateByValueFrom}, diff --git a/webgraph/src/graphs/permuted_graph.rs b/webgraph/src/graphs/permuted_graph.rs index fea51c9b..069f6309 100644 --- a/webgraph/src/graphs/permuted_graph.rs +++ b/webgraph/src/graphs/permuted_graph.rs @@ -47,11 +47,8 @@ impl> SequentialLabeling } } -impl< - 'b, - G: SequentialGraph + SplitLabeling, - P: SliceByValue + Send + Sync + Clone, - > SplitLabeling for PermutedGraph<'b, G, P> +impl<'b, G: SequentialGraph + SplitLabeling, P: SliceByValue + Send + Sync + Clone> + SplitLabeling for PermutedGraph<'b, G, P> where for<'a> ::Lender<'a>: Clone + ExactSizeLender + Send + Sync, { @@ -93,28 +90,26 @@ pub struct Iter<'node, I, P> { } impl< - 'succ, - I: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - P: SliceByValue, - > NodeLabelsLender<'succ> for Iter<'_, I, P> + 'succ, + I: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, + P: SliceByValue, +> NodeLabelsLender<'succ> for Iter<'_, I, P> { type Label = usize; type IntoIterator = Succ<'succ, LenderIntoIter<'succ, I>, P>; } impl< - 'succ, - I: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - P: SliceByValue, - > Lending<'succ> for Iter<'_, I, P> + 'succ, + I: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, + P: SliceByValue, +> Lending<'succ> for Iter<'_, I, P> { type Lend = (usize, >::IntoIterator); } -impl< - L: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - P: SliceByValue, - > Lender for Iter<'_, L, P> +impl NodeLabelsLender<'next, Label = usize>, P: SliceByValue> + Lender for Iter<'_, L, P> { #[inline(always)] fn next(&mut self) -> Option> { @@ -132,9 +127,9 @@ impl< } impl< - L: ExactSizeLender + for<'next> NodeLabelsLender<'next, Label = usize>, - P: SliceByValue, - > ExactSizeLender for Iter<'_, L, P> + L: ExactSizeLender + for<'next> NodeLabelsLender<'next, Label = usize>, + P: SliceByValue, +> ExactSizeLender for Iter<'_, L, P> { fn len(&self) -> usize { self.iter.len() diff --git a/webgraph/src/graphs/random/er.rs b/webgraph/src/graphs/random/er.rs index c8c1437b..8d81dc3b 100644 --- a/webgraph/src/graphs/random/er.rs +++ b/webgraph/src/graphs/random/er.rs @@ -7,7 +7,7 @@ use std::vec::IntoIter; use lender::{Lend, Lender, Lending}; -use rand::{rngs::SmallRng, Rng, SeedableRng}; +use rand::{Rng, SeedableRng, rngs::SmallRng}; use crate::{ prelude::{NodeLabelsLender, SequentialGraph, SequentialLabeling}, diff --git a/webgraph/src/graphs/union_graph.rs b/webgraph/src/graphs/union_graph.rs index 09be3361..834aa74e 100644 --- a/webgraph/src/graphs/union_graph.rs +++ b/webgraph/src/graphs/union_graph.rs @@ -96,28 +96,28 @@ where pub struct Iter(L, M); impl< - 'succ, - L: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - M: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - > NodeLabelsLender<'succ> for Iter + 'succ, + L: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, + M: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, +> NodeLabelsLender<'succ> for Iter { type Label = usize; type IntoIterator = Succ, LenderIntoIter<'succ, M>>; } impl< - 'succ, - L: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - M: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - > Lending<'succ> for Iter + 'succ, + L: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, + M: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, +> Lending<'succ> for Iter { type Lend = (usize, >::IntoIterator); } impl< - L: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - M: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, - > Lender for Iter + L: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, + M: Lender + for<'next> NodeLabelsLender<'next, Label = usize>, +> Lender for Iter { #[inline(always)] fn next(&mut self) -> Option> { @@ -134,9 +134,9 @@ impl< } impl< - L: Lender + for<'next> NodeLabelsLender<'next, Label = usize> + ExactSizeLender, - M: Lender + for<'next> NodeLabelsLender<'next, Label = usize> + ExactSizeLender, - > ExactSizeLender for Iter + L: Lender + for<'next> NodeLabelsLender<'next, Label = usize> + ExactSizeLender, + M: Lender + for<'next> NodeLabelsLender<'next, Label = usize> + ExactSizeLender, +> ExactSizeLender for Iter { fn len(&self) -> usize { self.0.len().max(self.1.len()) @@ -144,9 +144,9 @@ impl< } unsafe impl< - L: Lender + for<'next> NodeLabelsLender<'next, Label = usize> + SortedLender, - M: Lender + for<'next> NodeLabelsLender<'next, Label = usize> + SortedLender, - > SortedLender for Iter + L: Lender + for<'next> NodeLabelsLender<'next, Label = usize> + SortedLender, + M: Lender + for<'next> NodeLabelsLender<'next, Label = usize> + SortedLender, +> SortedLender for Iter { } diff --git a/webgraph/src/traits/graph.rs b/webgraph/src/traits/graph.rs index 5394f075..931f4a53 100644 --- a/webgraph/src/traits/graph.rs +++ b/webgraph/src/traits/graph.rs @@ -43,10 +43,10 @@ use impl_tools::autoimpl; use lender::*; use super::{ + SortedIterator, SortedLender, labels::EqError, lenders::{LenderIntoIter, NodeLabelsLender}, split::SplitLabeling, - SortedIterator, SortedLender, }; #[allow(non_camel_case_types)] diff --git a/webgraph/src/traits/labels.rs b/webgraph/src/traits/labels.rs index 8583d2d5..7620c9dd 100644 --- a/webgraph/src/traits/labels.rs +++ b/webgraph/src/traits/labels.rs @@ -492,7 +492,9 @@ pub enum CheckImplError { NumArcs { iter: u64, method: u64 }, /// The two implementations return different labels for a specific node. - #[error("Different successors for node {node}: at index {index} {sequential} (sequential) != {random_access} (random access)")] + #[error( + "Different successors for node {node}: at index {index} {sequential} (sequential) != {random_access} (random access)" + )] Successors { node: usize, index: usize, @@ -501,7 +503,9 @@ pub enum CheckImplError { }, /// The graphs have different outdegrees for a specific node. - #[error("Different outdegree for node {node}: {sequential} (sequential) != {random_access} (random access)")] + #[error( + "Different outdegree for node {node}: {sequential} (sequential) != {random_access} (random access)" + )] Outdegree { node: usize, sequential: usize, diff --git a/webgraph/src/traits/par_map_fold.rs b/webgraph/src/traits/par_map_fold.rs index 8bd529d1..7f85f6bd 100644 --- a/webgraph/src/traits/par_map_fold.rs +++ b/webgraph/src/traits/par_map_fold.rs @@ -197,7 +197,7 @@ where in_tx.send(val).unwrap(); } drop(in_tx); // close the channel so the threads will exit when done - // listen on the output channel for results + // listen on the output channel for results out_rx.into_iter().fold(A::default(), outer_fold) }) } diff --git a/webgraph/src/transform/perm.rs b/webgraph/src/transform/perm.rs index d6dc4114..b7d1bb17 100644 --- a/webgraph/src/transform/perm.rs +++ b/webgraph/src/transform/perm.rs @@ -7,7 +7,7 @@ use crate::graphs::arc_list_graph; use crate::prelude::sort_pairs::KMergeIters; use crate::prelude::*; -use anyhow::{ensure, Context, Result}; +use anyhow::{Context, Result, ensure}; use dsi_progress_logger::prelude::*; use lender::*; use rayon::ThreadPool; diff --git a/webgraph/src/transform/transpose.rs b/webgraph/src/transform/transpose.rs index 22a594f4..9a563c43 100644 --- a/webgraph/src/transform/transpose.rs +++ b/webgraph/src/transform/transpose.rs @@ -114,7 +114,7 @@ where .map(|iter| iter.into_labeled_pairs().map(|((a, b), l)| ((b, a), l))) .collect(); - par_sort_iters.try_sort_labeled::(batch_codec, pairs) + par_sort_iters.try_sort_labeled::(batch_codec, pairs) } /// Returns a [`SplitIters`] structure representing the @@ -155,7 +155,7 @@ pub fn transpose_split< let batch_codec = DefaultBatchCodec::default(); let SplitIters { boundaries, iters } = par_sort_iters - .try_sort_labeled::(batch_codec, pairs)?; + .try_sort_labeled::(batch_codec, pairs)?; Ok(SplitIters { boundaries, diff --git a/webgraph/src/utils/batch_codec/gaps.rs b/webgraph/src/utils/batch_codec/gaps.rs index 3f7831d0..d8cdeec0 100644 --- a/webgraph/src/utils/batch_codec/gaps.rs +++ b/webgraph/src/utils/batch_codec/gaps.rs @@ -11,7 +11,7 @@ use crate::traits::SortedIterator; use crate::utils::{ArcMmapHelper, MmapHelper, Triple}; use crate::{ traits::{BitDeserializer, BitSerializer}, - utils::{humanize, BatchCodec}, + utils::{BatchCodec, humanize}, }; use std::sync::Arc; @@ -263,11 +263,11 @@ pub struct GapsIterator< } unsafe impl< - E: Endianness, - D: BitDeserializer>, - const SRC_CODE: usize, - const DST_CODE: usize, - > SortedIterator for GapsIterator + E: Endianness, + D: BitDeserializer>, + const SRC_CODE: usize, + const DST_CODE: usize, +> SortedIterator for GapsIterator where BitReader: BitRead + CodesRead, BitWriter: BitWrite + CodesWrite, @@ -275,11 +275,11 @@ where } impl< - E: Endianness, - D: BitDeserializer>, - const SRC_CODE: usize, - const DST_CODE: usize, - > Iterator for GapsIterator + E: Endianness, + D: BitDeserializer>, + const SRC_CODE: usize, + const DST_CODE: usize, +> Iterator for GapsIterator where BitReader: BitRead + CodesRead, BitWriter: BitWrite + CodesWrite, @@ -308,11 +308,11 @@ where } impl< - E: Endianness, - D: BitDeserializer>, - const SRC_CODE: usize, - const DST_CODE: usize, - > ExactSizeIterator for GapsIterator + E: Endianness, + D: BitDeserializer>, + const SRC_CODE: usize, + const DST_CODE: usize, +> ExactSizeIterator for GapsIterator where BitReader: BitRead + CodesRead, BitWriter: BitWrite + CodesWrite, diff --git a/webgraph/src/utils/batch_codec/grouped_gaps.rs b/webgraph/src/utils/batch_codec/grouped_gaps.rs index fe8dc7ed..b962624c 100644 --- a/webgraph/src/utils/batch_codec/grouped_gaps.rs +++ b/webgraph/src/utils/batch_codec/grouped_gaps.rs @@ -9,7 +9,7 @@ use crate::traits::SortedIterator; use crate::utils::{ArcMmapHelper, MmapHelper, Triple}; use crate::{ traits::{BitDeserializer, BitSerializer}, - utils::{humanize, BatchCodec}, + utils::{BatchCodec, humanize}, }; use std::sync::Arc; @@ -87,13 +87,13 @@ where } impl< - E: Endianness, - S: BitSerializer> + Default, - D: BitDeserializer, DeserType = S::SerType> + Clone + Default, - const OUTDEGREE_CODE: usize, - const SRC_CODE: usize, - const DST_CODE: usize, - > Default for GroupedGapsCodec + E: Endianness, + S: BitSerializer> + Default, + D: BitDeserializer, DeserType = S::SerType> + Clone + Default, + const OUTDEGREE_CODE: usize, + const SRC_CODE: usize, + const DST_CODE: usize, +> Default for GroupedGapsCodec where BitReader: BitRead, BitWriter: BitWrite, @@ -208,7 +208,7 @@ where .write(&mut stream, (src - prev_src) as _) .with_context(|| format!("Could not write {src} after {prev_src}"))?; // figure out how many edges have this source - let outdegree = batch[i..].iter().take_while(|t| t.0 .0 == src).count(); + let outdegree = batch[i..].iter().take_while(|t| t.0.0 == src).count(); // write the outdegree stats.outdegree_bits += ConstCode:: .write(&mut stream, outdegree as _) @@ -294,12 +294,12 @@ pub struct GroupedGapsIterator< } unsafe impl< - E: Endianness, - D: BitDeserializer>, - const OUTDEGREE_CODE: usize, - const SRC_CODE: usize, - const DST_CODE: usize, - > SortedIterator for GroupedGapsIterator + E: Endianness, + D: BitDeserializer>, + const OUTDEGREE_CODE: usize, + const SRC_CODE: usize, + const DST_CODE: usize, +> SortedIterator for GroupedGapsIterator where BitReader: BitRead + CodesRead, BitWriter: BitWrite + CodesWrite, @@ -307,12 +307,12 @@ where } impl< - E: Endianness, - D: BitDeserializer>, - const OUTDEGREE_CODE: usize, - const SRC_CODE: usize, - const DST_CODE: usize, - > Iterator for GroupedGapsIterator + E: Endianness, + D: BitDeserializer>, + const OUTDEGREE_CODE: usize, + const SRC_CODE: usize, + const DST_CODE: usize, +> Iterator for GroupedGapsIterator where BitReader: BitRead + CodesRead, BitWriter: BitWrite + CodesWrite, @@ -345,12 +345,12 @@ where } impl< - E: Endianness, - D: BitDeserializer>, - const OUTDEGREE_CODE: usize, - const SRC_CODE: usize, - const DST_CODE: usize, - > ExactSizeIterator for GroupedGapsIterator + E: Endianness, + D: BitDeserializer>, + const OUTDEGREE_CODE: usize, + const SRC_CODE: usize, + const DST_CODE: usize, +> ExactSizeIterator for GroupedGapsIterator where BitReader: BitRead + CodesRead, BitWriter: BitWrite + CodesWrite, diff --git a/webgraph/src/utils/batch_codec/mod.rs b/webgraph/src/utils/batch_codec/mod.rs index e65870b2..861d5061 100644 --- a/webgraph/src/utils/batch_codec/mod.rs +++ b/webgraph/src/utils/batch_codec/mod.rs @@ -49,10 +49,7 @@ pub trait BatchCodec: Send + Sync { /// to use them in [`SortPairs`](crate::utils::sort_pairs::SortPairs) and /// then in [`ArcListGraph`](crate::graphs::arc_list_graph::ArcListGraph) /// which require them. - type DecodedBatch: IntoIterator< - Item = ((usize, usize), Self::Label), - IntoIter: Send + Sync + Clone, - >; + type DecodedBatch: IntoIterator; /// A type representing statistics about the encoded batch. /// This type has to implement `Display` so that we can log it. @@ -128,16 +125,16 @@ impl RadixKey for Triple { fn get_level(&self, level: usize) -> u8 { (if level < 8 { - self.0 .0 .1 >> ((level % 8) * 8) + self.0.0.1 >> ((level % 8) * 8) } else { - self.0 .0 .0 >> ((level % 8) * 8) + self.0.0.0 >> ((level % 8) * 8) }) as u8 } } impl PartialEq for Triple { fn eq(&self, other: &Self) -> bool { - self.0 .0 == other.0 .0 + self.0.0 == other.0.0 } } @@ -151,6 +148,6 @@ impl PartialOrd for Triple { impl Ord for Triple { fn cmp(&self, other: &Self) -> core::cmp::Ordering { - self.0 .0.cmp(&other.0 .0) + self.0.0.cmp(&other.0.0) } } diff --git a/webgraph/src/utils/mmap_helper.rs b/webgraph/src/utils/mmap_helper.rs index be440319..52003040 100644 --- a/webgraph/src/utils/mmap_helper.rs +++ b/webgraph/src/utils/mmap_helper.rs @@ -5,7 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later */ -use anyhow::{ensure, Context, Result}; +use anyhow::{Context, Result, ensure}; use common_traits::UnsignedInt; use core::fmt::Debug; use mmap_rs::*; diff --git a/webgraph/src/utils/mod.rs b/webgraph/src/utils/mod.rs index e761978b..320e8890 100644 --- a/webgraph/src/utils/mod.rs +++ b/webgraph/src/utils/mod.rs @@ -285,9 +285,9 @@ impl From<(Box<[usize]>, Box<[I]>)> for SplitIters { /// call is embedded in a larger expression, in which case an explicit type /// annotation might be necessary. impl< - I: Iterator + Send + Sync, - IT: IntoIterator, - > From> + I: Iterator + Send + Sync, + IT: IntoIterator, +> From> for Vec< crate::labels::proj::LeftIterator< Iter<(), std::iter::Map ((usize, usize), ())>>, @@ -325,10 +325,10 @@ impl< /// call is embedded in a larger expression, in which case an explicit type /// annotation might be necessary. impl< - L: Clone + Copy + 'static, - I: Iterator + Send + Sync, - IT: IntoIterator, - > From> for Vec> + L: Clone + Copy + 'static, + I: Iterator + Send + Sync, + IT: IntoIterator, +> From> for Vec> { fn from(split: SplitIters) -> Self { Box::into_iter(split.iters) diff --git a/webgraph/src/utils/par_sort_iters.rs b/webgraph/src/utils/par_sort_iters.rs index eda556fe..fe39d957 100644 --- a/webgraph/src/utils/par_sort_iters.rs +++ b/webgraph/src/utils/par_sort_iters.rs @@ -26,11 +26,11 @@ use core::num::NonZeroUsize; use sync_cell_slice::SyncSlice; use anyhow::{Context, Result}; -use dsi_progress_logger::{concurrent_progress_logger, ProgressLog}; +use dsi_progress_logger::{ProgressLog, concurrent_progress_logger}; use rayon::prelude::*; -use super::sort_pairs::KMergeIters; use super::MemoryUsage; +use super::sort_pairs::KMergeIters; use crate::utils::SplitIters; use crate::utils::{BatchCodec, CodecIter, DefaultBatchCodec}; @@ -131,7 +131,7 @@ impl ParSortIters { IntoIter: ExactSizeIterator + Send + Sync, >, ) -> Result>> { - let split = ::try_sort_labeled::( + let split = ::try_sort_labeled::( self, DefaultBatchCodec::default(), pairs @@ -211,17 +211,22 @@ impl ParSortIters { /// See [`try_sort_labeled`](ParSortIters::try_sort_labeled). /// /// This is a convenience method for iterators that cannot fail. - pub fn sort_labeled( + pub fn sort_labeled< + C: BatchCodec, + P: IntoIterator< + Item: IntoIterator + Send, + IntoIter: ExactSizeIterator, + >, + >( &self, batch_codec: C, - pairs: impl IntoIterator< - Item: IntoIterator + Send, - IntoIter: ExactSizeIterator, - >, + pairs: P, ) -> Result< - SplitIters>, + SplitIters< + impl IntoIterator + use, + >, > { - self.try_sort_labeled::(batch_codec, pairs) + self.try_sort_labeled::(batch_codec, pairs) } /// Sorts the output of the provided sequence of iterators of (labelled) @@ -235,15 +240,21 @@ impl ParSortIters { /// The bit deserializer must be [`Clone`] because we need one for each /// `BatchIterator`, and there are possible /// scenarios in which the deserializer might be stateful. - pub fn try_sort_labeled>( + pub fn try_sort_labeled< + C: BatchCodec, + E: Into, + P: IntoIterator< + Item: IntoIterator + Send, + IntoIter: ExactSizeIterator, + >, + >( &self, batch_codec: C, - pairs: impl IntoIterator< - Item: IntoIterator + Send, - IntoIter: ExactSizeIterator, - >, + pairs: P, ) -> Result< - SplitIters>, + SplitIters< + impl IntoIterator + use, + >, > { let unsorted_pairs = pairs; diff --git a/webgraph/src/utils/par_sort_pairs.rs b/webgraph/src/utils/par_sort_pairs.rs index cbb8af01..fddc8f0f 100644 --- a/webgraph/src/utils/par_sort_pairs.rs +++ b/webgraph/src/utils/par_sort_pairs.rs @@ -26,16 +26,16 @@ use std::num::NonZeroUsize; use std::path::Path; use std::sync::atomic::{AtomicUsize, Ordering}; -use anyhow::{ensure, Context, Result}; -use dsi_progress_logger::{concurrent_progress_logger, ProgressLog}; -use rayon::prelude::*; +use anyhow::{Context, Result, ensure}; +use dsi_progress_logger::{ProgressLog, concurrent_progress_logger}; use rayon::Yield; +use rayon::prelude::*; use thread_local::ThreadLocal; use crate::utils::DefaultBatchCodec; -use super::sort_pairs::KMergeIters; use super::MemoryUsage; +use super::sort_pairs::KMergeIters; use super::{BatchCodec, CodecIter}; use crate::utils::SplitIters; @@ -217,16 +217,17 @@ impl ParSortPairs { /// See [`try_sort_labeled`](ParSortPairs::try_sort_labeled). /// /// This is a convenience method for parallel iterators that cannot fail. - pub fn sort_labeled( + pub fn sort_labeled>( &self, batch_codec: &C, - pairs: impl ParallelIterator, + pairs: P, ) -> Result< SplitIters< - impl IntoIterator, + impl IntoIterator + + use, >, > { - self.try_sort_labeled::(batch_codec, pairs.map(Ok)) + self.try_sort_labeled::(batch_codec, pairs.map(Ok)) } /// Sorts the output of the provided parallel iterator, @@ -240,13 +241,18 @@ impl ParSortPairs { /// The bit deserializer must be [`Clone`] because we need one for each /// `BatchIterator`, and there are possible /// scenarios in which the deserializer might be stateful. - pub fn try_sort_labeled>( + pub fn try_sort_labeled< + C: BatchCodec, + E: Into, + P: ParallelIterator>, + >( &self, batch_codec: &C, - pairs: impl ParallelIterator>, + pairs: P, ) -> Result< SplitIters< - impl IntoIterator, + impl IntoIterator + + use, >, > { let unsorted_pairs = pairs; @@ -326,8 +332,8 @@ impl ParSortPairs { let partition_id = src / num_nodes_per_partition; let SorterThreadState { worker_id, - ref mut sorted_pairs, - ref mut unsorted_buffers, + sorted_pairs, + unsorted_buffers, } = &mut **thread_state; let sorted_pairs = &mut sorted_pairs[partition_id]; diff --git a/webgraph/src/utils/sort_pairs.rs b/webgraph/src/utils/sort_pairs.rs index 67570eb0..d23fe1d4 100644 --- a/webgraph/src/utils/sort_pairs.rs +++ b/webgraph/src/utils/sort_pairs.rs @@ -13,7 +13,7 @@ use crate::{ traits::SortedIterator, utils::{BatchCodec, CodecIter, DefaultBatchCodec, MemoryUsage}, }; -use anyhow::{anyhow, Context}; +use anyhow::{Context, anyhow}; use dary_heap::PeekMut; use std::path::{Path, PathBuf}; @@ -432,7 +432,7 @@ mod tests { use super::*; use crate::{ traits::{BitDeserializer, BitSerializer}, - utils::{gaps::GapsCodec, BitReader, BitWriter}, + utils::{BitReader, BitWriter, gaps::GapsCodec}, }; use dsi_bitstream::prelude::*; diff --git a/webgraph/src/visits/breadth_first/par_fair.rs b/webgraph/src/visits/breadth_first/par_fair.rs index 2d69e954..2b193120 100644 --- a/webgraph/src/visits/breadth_first/par_fair.rs +++ b/webgraph/src/visits/breadth_first/par_fair.rs @@ -5,7 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later */ -use crate::visits::{breadth_first::*, Parallel}; +use crate::visits::{Parallel, breadth_first::*}; use crate::{traits::RandomAccessGraph, utils::Granularity}; use parallel_frontier::Frontier; use rayon::prelude::*; diff --git a/webgraph/src/visits/breadth_first/par_low_mem.rs b/webgraph/src/visits/breadth_first/par_low_mem.rs index 61041605..7b4fe953 100644 --- a/webgraph/src/visits/breadth_first/par_low_mem.rs +++ b/webgraph/src/visits/breadth_first/par_low_mem.rs @@ -6,8 +6,8 @@ */ use crate::visits::{ - breadth_first::{EventPred, FilterArgsPred}, Parallel, + breadth_first::{EventPred, FilterArgsPred}, }; use crate::{traits::RandomAccessGraph, utils::Granularity}; use parallel_frontier::Frontier; diff --git a/webgraph/src/visits/breadth_first/seq.rs b/webgraph/src/visits/breadth_first/seq.rs index 6d91ae71..165a1760 100644 --- a/webgraph/src/visits/breadth_first/seq.rs +++ b/webgraph/src/visits/breadth_first/seq.rs @@ -8,8 +8,8 @@ use crate::traits::{RandomAccessGraph, RandomAccessLabeling}; use crate::visits::{ - breadth_first::{EventPred, FilterArgsPred}, Sequential, + breadth_first::{EventPred, FilterArgsPred}, }; use anyhow::Result; use nonmax::NonMaxUsize; @@ -452,7 +452,7 @@ impl<'a, 'b, G: RandomAccessGraph> BfsOrderFromRoots<'a, 'b, G> { roots: impl IntoIterator, ) -> Result> { visit.reset(); // ensure we start from a clean state - // put the roots in the queue, and add a level separator + // put the roots in the queue, and add a level separator visit.queue.extend( roots .into_iter() diff --git a/webgraph/src/visits/depth_first/seq.rs b/webgraph/src/visits/depth_first/seq.rs index ac0123aa..c4a07c3b 100644 --- a/webgraph/src/visits/depth_first/seq.rs +++ b/webgraph/src/visits/depth_first/seq.rs @@ -8,8 +8,8 @@ use crate::traits::{RandomAccessGraph, RandomAccessLabeling}; use crate::visits::{ - depth_first::{EventNoPred, EventPred, FilterArgsNoPred, FilterArgsPred}, Sequential, + depth_first::{EventNoPred, EventPred, FilterArgsNoPred, FilterArgsPred}, }; use sealed::sealed; use std::ops::ControlFlow::{self, Continue}; @@ -595,7 +595,7 @@ impl<'a, 'b, G: RandomAccessGraph> Iterator for DfsOrder<'a, 'b, G> { // while we have a stack while let Some((iter, parent)) = stack.last_mut() { let parent = *parent; // we need to deref - // and the top has successors + // and the top has successors for succ in iter { // Check if node should be visited if state.known(succ) { diff --git a/webgraph/tests/test_arc_list_graph.rs b/webgraph/tests/test_arc_list_graph.rs index 4fa2e507..60863092 100644 --- a/webgraph/tests/test_arc_list_graph.rs +++ b/webgraph/tests/test_arc_list_graph.rs @@ -14,7 +14,7 @@ use webgraph::{ vec_graph::LabeledVecGraph, }, prelude::BvGraph, - traits::{graph, NodeLabelsLender, RandomAccessLabeling, SequentialLabeling, SplitLabeling}, + traits::{NodeLabelsLender, RandomAccessLabeling, SequentialLabeling, SplitLabeling, graph}, utils::SplitIters, }; diff --git a/webgraph/tests/test_bvcomp.rs b/webgraph/tests/test_bvcomp.rs index 6866b329..73305012 100644 --- a/webgraph/tests/test_bvcomp.rs +++ b/webgraph/tests/test_bvcomp.rs @@ -11,12 +11,12 @@ use tempfile::NamedTempFile; const NODES: usize = 325557; +use Codes::{Delta, Gamma, Unary, Zeta}; use anyhow::Result; use dsi_bitstream::prelude::*; use dsi_progress_logger::prelude::*; use std::path::Path; use webgraph::{graphs::random::ErdosRenyi, prelude::*}; -use Codes::{Delta, Gamma, Unary, Zeta}; #[cfg_attr(feature = "slow_tests", test)] #[cfg_attr(not(feature = "slow_tests"), allow(dead_code))] diff --git a/webgraph/tests/test_csr_graph.rs b/webgraph/tests/test_csr_graph.rs index 9383e26d..f1e6e9ab 100644 --- a/webgraph/tests/test_csr_graph.rs +++ b/webgraph/tests/test_csr_graph.rs @@ -11,7 +11,7 @@ use epserde::{deser::Deserialize, ser::Serialize}; use webgraph::{ graphs::csr_graph::{CompressedCsrGraph, CompressedCsrSortedGraph, CsrSortedGraph}, prelude::{CsrGraph, VecGraph}, - traits::{graph, labels, SequentialGraph, SortedLender}, + traits::{SequentialGraph, SortedLender, graph, labels}, }; /// Helper function to test epserde serialization/deserialization for CSR graph types diff --git a/webgraph/tests/test_depth_first.rs b/webgraph/tests/test_depth_first.rs index 060284ab..4d65249a 100644 --- a/webgraph/tests/test_depth_first.rs +++ b/webgraph/tests/test_depth_first.rs @@ -7,8 +7,8 @@ */ use no_break::NoBreak; -use webgraph::{prelude::depth_first, visits::Sequential}; use webgraph::{prelude::VecGraph, traits::SequentialLabeling}; +use webgraph::{prelude::depth_first, visits::Sequential}; #[test] fn test_depth() { diff --git a/webgraph/tests/test_iter.rs b/webgraph/tests/test_iter.rs index edcb6d62..054169a0 100644 --- a/webgraph/tests/test_iter.rs +++ b/webgraph/tests/test_iter.rs @@ -5,10 +5,10 @@ * SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later */ -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use dsi_bitstream::prelude::BE; use lender::*; -use rand::{rngs::SmallRng, seq::SliceRandom, SeedableRng}; +use rand::{SeedableRng, rngs::SmallRng, seq::SliceRandom}; use webgraph::{graphs::arc_list_graph::ArcListGraph, prelude::*}; #[test] diff --git a/webgraph/tests/test_proj.rs b/webgraph/tests/test_proj.rs index 3a353d1f..f0aca79f 100644 --- a/webgraph/tests/test_proj.rs +++ b/webgraph/tests/test_proj.rs @@ -7,8 +7,8 @@ use lender::*; use webgraph::graphs::vec_graph::VecGraph; -use webgraph::labels::proj::{Left, Right}; use webgraph::labels::Zip; +use webgraph::labels::proj::{Left, Right}; use webgraph::traits::RandomAccessLabeling; #[test] diff --git a/webgraph/tests/test_transpose.rs b/webgraph/tests/test_transpose.rs index f4742fa8..5e0936b2 100644 --- a/webgraph/tests/test_transpose.rs +++ b/webgraph/tests/test_transpose.rs @@ -6,14 +6,14 @@ */ use dsi_bitstream::codes::{GammaRead, GammaWrite}; +use dsi_bitstream::traits::{BE, Endianness}; use dsi_bitstream::traits::{BitRead, BitWrite}; -use dsi_bitstream::traits::{Endianness, BE}; use webgraph::graphs::vec_graph::LabeledVecGraph; use webgraph::prelude::{transpose, transpose_labeled, transpose_split}; use webgraph::traits::labels::SequentialLabeling; -use webgraph::traits::{graph, BitDeserializer, BitSerializer}; -use webgraph::utils::gaps::GapsCodec; +use webgraph::traits::{BitDeserializer, BitSerializer, graph}; use webgraph::utils::MemoryUsage; +use webgraph::utils::gaps::GapsCodec; use webgraph::utils::{BitReader, BitWriter}; #[test] diff --git a/webgraph/tests/test_vec_graph.rs b/webgraph/tests/test_vec_graph.rs index 580de7ea..f421afeb 100644 --- a/webgraph/tests/test_vec_graph.rs +++ b/webgraph/tests/test_vec_graph.rs @@ -9,7 +9,7 @@ use webgraph::{ graphs::{random::ErdosRenyi, vec_graph::LabeledVecGraph}, labels::Zip, prelude::VecGraph, - traits::{graph, labels, SequentialLabeling}, + traits::{SequentialLabeling, graph, labels}, }; #[test]