diff --git a/Cargo.toml b/Cargo.toml index 546db24..9258d71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "graphene" version = "0.1.5" authors = ["Emad Jacob Maroun "] -edition = "2018" +edition = "2021" description = "A general purpose, extensible Graph Theory data type and algorithm library for Rust." @@ -19,7 +19,7 @@ categories = ["data-structures","algorithms"] travis-ci = {repository = "Emoun/graphene"} [dependencies] -delegate = "0.4.2" +delegate = "0.13.1" tt-equal = "0.1" tt-call = "1.0" num-traits = "0.2" @@ -29,4 +29,4 @@ rand = "0.7" quickcheck = "0.9" quickcheck_macros = "0.9" static_assertions = "1.1.0" -duplicate = "0.2.9" \ No newline at end of file +duplicate = "2.0.0" diff --git a/rustfmt.toml b/rustfmt.toml index cb4cc24..dc2746e 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -6,7 +6,7 @@ empty_item_single_line=true force_multiline_blocks=true format_strings=true hard_tabs=true -merge_imports=true +imports_granularity="Crate" newline_style="Unix" normalize_comments=true normalize_doc_attributes=true diff --git a/src/common/adjacency_list/impl_graph.rs b/src/common/adjacency_list/impl_graph.rs index bf4fa96..d718f81 100644 --- a/src/common/adjacency_list/impl_graph.rs +++ b/src/common/adjacency_list/impl_graph.rs @@ -16,9 +16,9 @@ where type Vertex = usize; type VertexWeight = Vw; - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box> + fn all_vertices_weighted( + &self, + ) -> Box> { Box::new(self.vertices.iter().enumerate().map(|(v, (w, _))| (v, w))) } diff --git a/src/common/adjacency_list/mod.rs b/src/common/adjacency_list/mod.rs index c4b1dec..59bbb76 100644 --- a/src/common/adjacency_list/mod.rs +++ b/src/common/adjacency_list/mod.rs @@ -1,6 +1,5 @@ mod impl_graph; -pub use self::impl_graph::*; use crate::core::{Directed, Directedness}; use std::marker::PhantomData; diff --git a/src/core/graph.rs b/src/core/graph.rs index 9163a92..ab74790 100644 --- a/src/core/graph.rs +++ b/src/core/graph.rs @@ -75,9 +75,9 @@ pub trait Graph type Directedness: Directedness; /// Returns copies of all current vertex values in the graph. - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box>; + fn all_vertices_weighted( + &self, + ) -> Box>; /// Returns the weights of all edges that are sourced in v1 and sinked in /// v2. I.e. all edges where e == (v1,v2,_). @@ -216,11 +216,12 @@ pub trait Graph { self.edges_between(v1.borrow(), v2.borrow()) .next() - .is_some() || (Self::Directedness::directed() - && self - .edges_between(v2.borrow(), v1.borrow()) - .next() - .is_some()) + .is_some() + || (Self::Directedness::directed() + && self + .edges_between(v2.borrow(), v1.borrow()) + .next() + .is_some()) } } @@ -232,9 +233,9 @@ pub trait Graph /// methods plus some additional utilities. pub trait GraphMut: Graph { - fn all_vertices_weighted_mut<'a>( - &'a mut self, - ) -> Box>; + fn all_vertices_weighted_mut( + &mut self, + ) -> Box>; fn edges_between_mut<'a: 'b, 'b>( &'a mut self, diff --git a/src/core/property/acyclic.rs b/src/core/property/acyclic.rs index 2aa0952..8aa8cc6 100644 --- a/src/core/property/acyclic.rs +++ b/src/core/property/acyclic.rs @@ -8,9 +8,7 @@ use crate::{ use std::borrow::Borrow; /// An acyclic graph -pub trait Acyclic: NoLoops -{ -} +pub trait Acyclic: NoLoops {} #[derive(Clone, Debug)] pub struct AcyclicGraph(C); diff --git a/src/core/property/connected.rs b/src/core/property/connected.rs index 5ac7e1d..4266e86 100644 --- a/src/core/property/connected.rs +++ b/src/core/property/connected.rs @@ -15,9 +15,7 @@ use std::borrow::Borrow; /// /// A graph is connected if there is a path from any vertex to any other vertex. /// Graphs with one or zero vertices count as connected. -pub trait Connected: Unilateral -{ -} +pub trait Connected: Unilateral {} #[derive(Clone, Debug)] pub struct ConnectedGraph(C); diff --git a/src/core/property/directedness_ensurers.rs b/src/core/property/directedness_ensurers.rs index 8558560..3b73d5e 100644 --- a/src/core/property/directedness_ensurers.rs +++ b/src/core/property/directedness_ensurers.rs @@ -27,9 +27,9 @@ impl Graph for DirectedGraph delegate! { to self.0.graph() { - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box>; + fn all_vertices_weighted( + &self, + ) -> Box>; fn edges_between<'a: 'b, 'b>( &'a self, @@ -70,9 +70,9 @@ impl Graph for UndirectedGraph delegate! { to self.0.graph() { - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box>; + fn all_vertices_weighted( + &self, + ) -> Box>; fn edges_between<'a: 'b, 'b>( &'a self, diff --git a/src/core/property/impl_ensurer.rs b/src/core/property/impl_ensurer.rs index 8c47040..575b158 100644 --- a/src/core/property/impl_ensurer.rs +++ b/src/core/property/impl_ensurer.rs @@ -244,9 +244,9 @@ macro_rules! impl_properties { delegate::delegate! { to $crate::core::GraphDeref::graph(&self$($delegate)+){ - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box>; + fn all_vertices_weighted( + &self, + ) -> Box>; fn edges_between<'a: 'b, 'b>( &'a self, @@ -275,11 +275,9 @@ macro_rules! impl_properties { @implement { delegate::delegate! { to $crate::core::GraphDerefMut::graph_mut(&mut self$($delegate)+) { - fn all_vertices_weighted_mut<'a>( - &'a mut self, - ) -> Box>; + fn all_vertices_weighted_mut( + &mut self, + ) -> Box>; fn edges_between_mut<'a: 'b, 'b>( &'a mut self, @@ -511,7 +509,7 @@ macro_rules! impl_properties { @implement { delegate::delegate!{ to $crate::core::GraphDeref::graph(&self$($delegate)+) { - fn exit_edges<'a>(&'a self) -> Box Box>; } } diff --git a/src/core/property/mod.rs b/src/core/property/mod.rs index fa50723..dcc1f0b 100644 --- a/src/core/property/mod.rs +++ b/src/core/property/mod.rs @@ -14,9 +14,8 @@ mod unique; mod weak; pub use self::{ - acyclic::*, base_props::*, connected::*, directedness_ensurers::*, has_vertex::*, - impl_ensurer::*, no_loops::*, reflexive::*, rooted::*, subgraph::*, unilateral::*, unique::*, - weak::*, + acyclic::*, base_props::*, connected::*, directedness_ensurers::*, has_vertex::*, no_loops::*, + reflexive::*, rooted::*, subgraph::*, unilateral::*, unique::*, weak::*, }; use crate::core::{ proxy::{EdgeProxyGraph, ProxyVertex, VertexProxyGraph}, diff --git a/src/core/property/no_loops.rs b/src/core/property/no_loops.rs index fb73529..6a93965 100644 --- a/src/core/property/no_loops.rs +++ b/src/core/property/no_loops.rs @@ -6,9 +6,7 @@ use std::borrow::Borrow; /// In graph theory, a loop is an edge that connects a vertex to itself. /// This trait guarantees that there are no loops in the graph and that no loops /// can be added to it. -pub trait NoLoops: Graph -{ -} +pub trait NoLoops: Graph {} pub struct NoLoopsGraph(C); diff --git a/src/core/property/subgraph.rs b/src/core/property/subgraph.rs index ab093bc..0eaa8a1 100644 --- a/src/core/property/subgraph.rs +++ b/src/core/property/subgraph.rs @@ -3,7 +3,7 @@ use crate::core::{Edge, Graph}; pub trait Subgraph: Graph { /// Edges who's sources are in this subgraph but who's sinks aren't. - fn exit_edges<'a>(&'a self) -> Box>; + fn exit_edges(&self) -> Box>; /// Whether this subgraph can reach a vertex in the other subgraph, either /// by sharing a vertex with it, or having an axit edge to one of its diff --git a/src/core/property/unilateral.rs b/src/core/property/unilateral.rs index 2a4f19c..bba2270 100644 --- a/src/core/property/unilateral.rs +++ b/src/core/property/unilateral.rs @@ -23,9 +23,7 @@ use std::borrow::Borrow; /// For undirected graph, simply use `ConnectedGraph`. /// /// For type safety reasons, the trait itself does not restrict directedness. -pub trait Unilateral: Weak -{ -} +pub trait Unilateral: Weak {} #[derive(Clone, Debug)] pub struct UnilateralGraph(C) diff --git a/src/core/property/weak.rs b/src/core/property/weak.rs index 5c9889e..a60af23 100644 --- a/src/core/property/weak.rs +++ b/src/core/property/weak.rs @@ -19,9 +19,7 @@ use std::borrow::Borrow; /// undirected graph, simply use `ConnectedGraph`. /// /// For type safety reasons, the trait itself does not restrict directedness. -pub trait Weak: Graph -{ -} +pub trait Weak: Graph {} #[derive(Clone, Debug)] pub struct WeakGraph(C) diff --git a/src/core/proxy/edge_proxy.rs b/src/core/proxy/edge_proxy.rs index 97893d3..d7a459f 100644 --- a/src/core/proxy/edge_proxy.rs +++ b/src/core/proxy/edge_proxy.rs @@ -3,7 +3,7 @@ use crate::core::{ Directedness, Edge, Ensure, Graph, GraphDerefMut, GraphMut, }; use delegate::delegate; -use std::borrow::Borrow; +use std::{borrow::Borrow, cell::UnsafeCell}; /// A wrapper around a graph, that allows for addition and removal /// of edges, without mutating the underlying graph. @@ -55,9 +55,9 @@ impl Graph for EdgeProxyGraph delegate! { to self.graph.graph() { - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box>; + fn all_vertices_weighted( + &self, + ) -> Box>; } } @@ -94,9 +94,9 @@ where { delegate! { to self.graph.graph_mut() { - fn all_vertices_weighted_mut<'a>( - &'a mut self, - ) -> Box>; + fn all_vertices_weighted_mut( + &mut self, + ) -> Box>; } } @@ -109,7 +109,7 @@ where // Safe because &mut () can't mutate anything Box::new( self.edges_between(source, sink) - .map(|w| unsafe { &mut *((w as *const ()) as *mut ()) }), + .map(|_| unsafe { &mut *UnsafeCell::new(()).get() }), ) } } diff --git a/src/core/proxy/reverse_graph.rs b/src/core/proxy/reverse_graph.rs index b4f51d6..9223a9f 100644 --- a/src/core/proxy/reverse_graph.rs +++ b/src/core/proxy/reverse_graph.rs @@ -32,8 +32,8 @@ where delegate! { to self.0.graph() { - fn all_vertices_weighted<'a>(&'a self) -> Box>; + fn all_vertices_weighted(&self) -> Box>; } } @@ -53,8 +53,8 @@ where { delegate! { to self.0.graph_mut() { - fn all_vertices_weighted_mut<'a>(&'a mut self) -> Box>; + fn all_vertices_weighted_mut(&mut self) -> Box>; } } diff --git a/src/core/proxy/subgraph_proxy.rs b/src/core/proxy/subgraph_proxy.rs index 159f2e0..9af9244 100644 --- a/src/core/proxy/subgraph_proxy.rs +++ b/src/core/proxy/subgraph_proxy.rs @@ -69,9 +69,9 @@ impl Graph for SubgraphProxy type Vertex = ::Vertex; type VertexWeight = ::VertexWeight; - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box> + fn all_vertices_weighted( + &self, + ) -> Box> { Box::new( self.graph diff --git a/src/core/proxy/undirected_proxy.rs b/src/core/proxy/undirected_proxy.rs index 11f4fc9..2351887 100644 --- a/src/core/proxy/undirected_proxy.rs +++ b/src/core/proxy/undirected_proxy.rs @@ -31,9 +31,9 @@ where delegate! { to self.0.graph() { - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box>; + fn all_vertices_weighted( + &self, + ) -> Box>; } } diff --git a/src/core/proxy/vertex_proxy.rs b/src/core/proxy/vertex_proxy.rs index 1ae7b45..a4c2196 100644 --- a/src/core/proxy/vertex_proxy.rs +++ b/src/core/proxy/vertex_proxy.rs @@ -50,9 +50,9 @@ impl Graph for VertexProxyGraph type Vertex = ProxyVertex<::Vertex>; type VertexWeight = (); - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box> + fn all_vertices_weighted( + &self, + ) -> Box> { Box::new( self.graph diff --git a/tests/algo/bfs.rs b/tests/algo/bfs.rs index bc7acb9..265dbe1 100644 --- a/tests/algo/bfs.rs +++ b/tests/algo/bfs.rs @@ -1,5 +1,5 @@ use crate::mock_graph::{arbitrary::Arb, MockGraph}; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::{ algo::Bfs, core::{ @@ -9,7 +9,7 @@ use graphene::{ }; use std::collections::HashSet; -#[duplicate( +#[duplicate_item( directedness; [ Directed ]; [ Undirected ] )] mod __ diff --git a/tests/algo/dfs.rs b/tests/algo/dfs.rs index 892981d..8be2d0e 100644 --- a/tests/algo/dfs.rs +++ b/tests/algo/dfs.rs @@ -1,7 +1,7 @@ //! Tests `Dfs` use crate::mock_graph::{arbitrary::Arb, MockGraph, MockVertex}; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::{ algo::Dfs, core::{ @@ -11,7 +11,7 @@ use graphene::{ }; use std::cell::Cell; -#[duplicate( +#[duplicate_item( directedness; [ Directed ]; [ Undirected ] )] mod __ diff --git a/tests/algo/dijkstra_shortest_paths.rs b/tests/algo/dijkstra_shortest_paths.rs index c6f770f..24a5bbb 100644 --- a/tests/algo/dijkstra_shortest_paths.rs +++ b/tests/algo/dijkstra_shortest_paths.rs @@ -1,7 +1,7 @@ use crate::mock_graph::arbitrary::{Arb, VerticesIn}; /// tests `DijkstraShortestPath` use crate::mock_graph::{MockEdgeWeight, MockGraph}; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::{ algo::DijkstraShortestPaths, core::{ @@ -11,7 +11,7 @@ use graphene::{ }; use std::collections::{HashMap, HashSet}; -#[duplicate( +#[duplicate_item( directedness; [ Directed ]; [ Undirected ] )] mod __ diff --git a/tests/algo/search.rs b/tests/algo/search.rs index 7fc1a96..f4e7eb0 100644 --- a/tests/algo/search.rs +++ b/tests/algo/search.rs @@ -1,7 +1,7 @@ use crate::mock_graph::arbitrary::Arb; /// Common tests for all 'searching' algorithms. use crate::mock_graph::{MockEdgeWeight, MockGraph}; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::{ algo::{Bfs, Dfs, Spfs}, core::{ @@ -19,7 +19,7 @@ fn spfs_new>(g: &G) -> Spfs Spfs::new(g, |v| v.value) } -#[duplicate( +#[duplicate_item( module search_algo_new; [ dfs ] [ Dfs::new_simple ]; [ bfs ] [ Bfs::new ]; @@ -30,7 +30,7 @@ mod module use super::*; use crate::mock_graph::arbitrary::VerticesIn; - #[duplicate( + #[duplicate_item( directedness; [ Directed ]; [ Undirected ] )] mod __ diff --git a/tests/common/adjacency_list/impl_graph.rs b/tests/common/adjacency_list/impl_graph.rs index 338a66d..6c61fde 100644 --- a/tests/common/adjacency_list/impl_graph.rs +++ b/tests/common/adjacency_list/impl_graph.rs @@ -8,13 +8,13 @@ use crate::{ MockGraph, }, }; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::core::{ property::{EdgeCount, HasVertex, RemoveEdge, RemoveVertex, VertexCount, VertexInGraph}, Directed, Graph, GraphMut, ReleaseUnloaded, Undirected, }; -#[duplicate( +#[duplicate_item( directedness; [Directed]; [Undirected]; )] mod __ diff --git a/tests/common/ensured.rs b/tests/common/ensured.rs index 15ae70b..23d60fe 100644 --- a/tests/common/ensured.rs +++ b/tests/common/ensured.rs @@ -2,7 +2,7 @@ //! the new versions of each method give the same result //! as the original. use crate::mock_graph::{arbitrary::Arb, MockGraph, MockVertex, MockVertexWeight}; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::{ common::Ensured, core::{ @@ -17,7 +17,7 @@ use graphene::{ /// for both calls. This will ensure even through one of them is /// renamed (using a tool to find and rename usages automatically), this /// will fail to compile if the other isn't renamed too. -#[duplicate( +#[duplicate_item( contains_vertex; [contains_vertex] )] #[quickcheck] @@ -35,7 +35,7 @@ fn contains_vertex(Arb(graph): Arb>, v: MockVertex) -> bool /// Tests that `new_vertex` and `new_vertex_weighted` for EnsureGraph are /// identical to their originals. -#[duplicate( +#[duplicate_item( new_vertex arguments; [new_vertex_weighted] [_w.clone()]; [new_vertex] [] diff --git a/tests/core/ensure.rs b/tests/core/ensure.rs index 580a043..0f7c7f7 100644 --- a/tests/core/ensure.rs +++ b/tests/core/ensure.rs @@ -70,13 +70,13 @@ impl Graph for MockEnsurer delegate! { to self.0.graph() { - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box>; + fn all_vertices_weighted( + &self, + ) -> Box>; - fn all_edges<'a>( - &'a self, - ) -> Box>; + fn all_edges( + &self, + ) -> Box>; fn edges_between<'a: 'b, 'b>( &'a self, @@ -92,9 +92,9 @@ where { delegate! { to self.0.graph_mut() { - fn all_vertices_weighted_mut<'a>( - &'a mut self, - ) -> Box>; + fn all_vertices_weighted_mut( + &mut self, + ) -> Box>; fn edges_between_mut<'a: 'b, 'b>( &'a mut self, @@ -171,13 +171,13 @@ impl Graph for MockUnloadedEnsurer delegate! { to self.0.graph() { - fn all_vertices_weighted<'a>( - &'a self, - ) -> Box>; + fn all_vertices_weighted( + &self, + ) -> Box>; - fn all_edges<'a>( - &'a self, - ) -> Box>; + fn all_edges( + &self, + ) -> Box>; fn edges_between<'a: 'b, 'b>( &'a self, diff --git a/tests/core/graph/edge_lookup_methods.rs b/tests/core/graph/edge_lookup_methods.rs index f899589..4dea7a5 100644 --- a/tests/core/graph/edge_lookup_methods.rs +++ b/tests/core/graph/edge_lookup_methods.rs @@ -4,7 +4,7 @@ use crate::mock_graph::{ utilities::*, MockGraph, }; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::core::{ property::{HasVertex, VertexInGraph}, Directed, Edge, Graph, ReleaseUnloaded, Undirected, @@ -12,22 +12,24 @@ use graphene::core::{ use crate::mock_graph::arbitrary::{Arb, TwoVerticesIn}; -#[duplicate( - #[ - module_nested method_nested closure_nested directedness_nested; - [edges_sourced_in_directed] [edges_sourced_in] [e.source() == v] [ Directed ]; - [edges_sinked_in_directed] [edges_sinked_in] [e.sink() == v] [ Directed ]; - [edges_incident_directed] [edges_incident_on] [e.source() == v - || e.sink() == v] [ Directed ]; - #[ - module method; - [edges_sourced_in_undirected] [edges_sourced_in]; - [edges_sinked_in_undirected] [edges_sinked_in]; - [edges_incident_undirected] [edges_incident_on]; - ][ - [module] [method] [e.source() == v || e.sink() == v] [ Undirected ]; +#[duplicate_item( + duplicate!{ + [ + module_nested method_nested closure_nested directedness_nested; + [edges_sourced_in_directed] [edges_sourced_in] [e.source() == v] [ Directed ]; + [edges_sinked_in_directed] [edges_sinked_in] [e.sink() == v] [ Directed ]; + [edges_incident_directed] [edges_incident_on] [e.source() == v + || e.sink() == v] [ Directed ]; + duplicate!{ + [ + module method; + [edges_sourced_in_undirected] [edges_sourced_in]; + [edges_sinked_in_undirected] [edges_sinked_in]; + [edges_incident_undirected] [edges_incident_on]; + ] + [module] [method] [e.source() == v || e.sink() == v] [ Undirected ]; + } ] - ][ [ module [ module_nested ] method [ method_nested ] @@ -39,12 +41,13 @@ use crate::mock_graph::arbitrary::{Arb, TwoVerticesIn}; arb_invalid_graph [ VertexOutside ] base_graph [ MockGraph ] ] - ] - #[ - module_nested directedness closure_additional; - [edges_between_directed] [Directed] [ false ]; - [edges_between_undirected] [Undirected] [ (e.source() == _v2 && e.sink() == v) ]; - ][ + } + duplicate!{ + [ + module_nested directedness closure_additional; + [edges_between_directed] [Directed] [ false ]; + [edges_between_undirected] [Undirected] [ (e.source() == _v2 && e.sink() == v) ]; + ] [ module [module_nested] method [edges_between] @@ -64,7 +67,7 @@ use crate::mock_graph::arbitrary::{Arb, TwoVerticesIn}; arb_invalid_graph [ EdgeOutside ] base_graph [ MockGraph ] ] - ] + } )] mod module { diff --git a/tests/core/property/acyclic.rs b/tests/core/property/acyclic.rs index 393d486..3d4e597 100644 --- a/tests/core/property/acyclic.rs +++ b/tests/core/property/acyclic.rs @@ -4,14 +4,14 @@ use crate::mock_graph::{ arbitrary::{Arb, EdgeIn, TwoReachableVerticesIn}, MockEdgeWeight, MockGraph, }; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::core::{ property::{Acyclic, AcyclicGraph, AddEdge, HasVertex, NoLoops, RemoveEdge}, Directed, EnsureUnloaded, Graph, ReleaseUnloaded, Undirected, }; use static_assertions::assert_impl_all; -#[duplicate( +#[duplicate_item( directedness; [ Directed ]; [ Undirected ] )] mod __ diff --git a/tests/core/property/connectedness.rs b/tests/core/property/connectedness.rs index b5263b6..a3d4380 100644 --- a/tests/core/property/connectedness.rs +++ b/tests/core/property/connectedness.rs @@ -4,7 +4,7 @@ use crate::mock_graph::{ arbitrary::{Arb, TwoVerticesIn, UnconnectedGraph}, MockDirectedness, MockEdgeWeight, MockGraph, MockVertexWeight, }; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::core::{ property::{ AddEdge, Connected, ConnectedGraph, HasVertex, NewVertex, RemoveEdge, RemoveVertex, @@ -14,12 +14,13 @@ use graphene::core::{ }; use static_assertions::assert_impl_all; -#[duplicate( - #[ - module_connected directedness; - [connected_directed] [Directed]; - [connected_undirected] [Undirected] - ][ +#[duplicate_item( + duplicate!{ + [ + module_connected directedness; + [connected_directed] [Directed]; + [connected_undirected] [Undirected] + ] [ module [ module_connected ] connected_graph [ ConnectedGraph ] @@ -27,7 +28,7 @@ use static_assertions::assert_impl_all; arb_unconnected [ UnconnectedGraph ] arb_reject_remove [ ConnectedGraph> ] ] - ] + } [ module [ unilateral ] connected_graph [ UnilateralGraph ] diff --git a/tests/core/property/has_vertex_rooted.rs b/tests/core/property/has_vertex_rooted.rs index 02283a4..bb45da9 100644 --- a/tests/core/property/has_vertex_rooted.rs +++ b/tests/core/property/has_vertex_rooted.rs @@ -4,7 +4,7 @@ use crate::mock_graph::{ arbitrary::{Arb, TwoVerticesIn}, MockGraph, MockVertexWeight, }; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::core::{ property::{ HasVertex, HasVertexGraph, NewVertex, RemoveVertex, Rooted, RootedGraph, VertexInGraph, @@ -12,7 +12,7 @@ use graphene::core::{ Directed, Undirected, }; -#[duplicate( +#[duplicate_item( directedness; [ Directed ]; [ Undirected ] )] mod __ @@ -65,7 +65,7 @@ mod __ } } - #[duplicate( + #[duplicate_item( GraphStruct get_method set_method; [ VertexInGraph ] [ get_vertex ] [ set_vertex ]; [ RootedGraph ] [ root ] [ set_root ] diff --git a/tests/core/property/unique.rs b/tests/core/property/unique.rs index bdfc607..895f5c9 100644 --- a/tests/core/property/unique.rs +++ b/tests/core/property/unique.rs @@ -3,13 +3,13 @@ use crate::mock_graph::{ arbitrary::{Arb, EdgeIn, NonUniqueGraph}, MockEdgeWeight, MockGraph, MockVertexWeight, }; -use duplicate::duplicate; +use duplicate::duplicate_item; use graphene::core::{ property::{AddEdge, HasVertex, NewVertex, UniqueGraph, VertexInGraph}, Directed, EnsureUnloaded, Graph, ReleaseUnloaded, Undirected, }; -#[duplicate( +#[duplicate_item( directedness; [ Directed ]; [ Undirected ] )] mod __ diff --git a/tests/mock_graph/arbitrary/combinations/edge_outside.rs b/tests/mock_graph/arbitrary/combinations/edge_outside.rs index bd8022a..43730bb 100644 --- a/tests/mock_graph/arbitrary/combinations/edge_outside.rs +++ b/tests/mock_graph/arbitrary/combinations/edge_outside.rs @@ -76,7 +76,8 @@ where .map(|g| Self(g, self.1, self.2)), ); - // We then shrink the vertices, ensuring that at least one of them stays invalid + // We then shrink the vertices, ensuring that at least one of them stays + // invalid result.extend( self.1 .shrink() diff --git a/tests/mock_graph/arbitrary/mod.rs b/tests/mock_graph/arbitrary/mod.rs index ae4207e..70bf663 100644 --- a/tests/mock_graph/arbitrary/mod.rs +++ b/tests/mock_graph/arbitrary/mod.rs @@ -7,6 +7,5 @@ mod unique_graph; mod vertex_in_graph; pub use self::{ - acyclic_graph::*, combinations::*, connected_graph::*, guided_arb_graph::*, mock_graph::*, - unique_graph::*, vertex_in_graph::*, + acyclic_graph::*, combinations::*, connected_graph::*, guided_arb_graph::*, unique_graph::*, };