Switch to "use crate::" syntax
diff --git a/src/algo/dominators.rs b/src/algo/dominators.rs
index fd41140..e6b22f4 100644
--- a/src/algo/dominators.rs
+++ b/src/algo/dominators.rs
@@ -15,7 +15,7 @@
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
-use visit::{DfsPostOrder, GraphBase, IntoNeighbors, Visitable, Walker};
+use crate::visit::{DfsPostOrder, GraphBase, IntoNeighbors, Visitable, Walker};
/// The dominance relation for some graph and root.
#[derive(Debug, Clone)]
diff --git a/src/algo/mod.rs b/src/algo/mod.rs
index b64f536..6c7ea62 100644
--- a/src/algo/mod.rs
+++ b/src/algo/mod.rs
@@ -9,12 +9,12 @@
use std::collections::BinaryHeap;
use std::cmp::min;
-use prelude::*;
+use crate::prelude::*;
use super::{
EdgeType,
};
-use scored::MinScored;
+use crate::scored::MinScored;
use super::visit::{
GraphRef,
GraphBase,
@@ -34,9 +34,9 @@
use super::graph::{
IndexType,
};
-use visit::{Data, NodeRef, IntoNodeReferences};
-use visit::Walker;
-use data::{
+use crate::visit::{Data, NodeRef, IntoNodeReferences};
+use crate::visit::Walker;
+use crate::data::{
Element,
};
@@ -194,7 +194,7 @@
pub fn is_cyclic_directed<G>(g: G) -> bool
where G: IntoNodeIdentifiers + IntoNeighbors + Visitable,
{
- use visit::{depth_first_search, DfsEvent};
+ use crate::visit::{depth_first_search, DfsEvent};
depth_first_search(g, g.node_identifiers(), |event| {
match event {
diff --git a/src/astar.rs b/src/astar.rs
index 0ebd4fe..a3af04a 100644
--- a/src/astar.rs
+++ b/src/astar.rs
@@ -9,7 +9,7 @@
use std::hash::Hash;
-use scored::MinScored;
+use crate::scored::MinScored;
use super::visit::{
EdgeRef,
GraphBase,
@@ -18,7 +18,7 @@
Visitable,
};
-use algo::Measure;
+use crate::algo::Measure;
/// [Generic] A* shortest path algorithm.
///
diff --git a/src/csr.rs b/src/csr.rs
index dad2d38..0f96a0e 100644
--- a/src/csr.rs
+++ b/src/csr.rs
@@ -6,16 +6,16 @@
use std::iter::{Enumerate, Zip};
use std::slice::Windows;
-use visit::{EdgeRef, GraphBase, IntoNeighbors, NodeIndexable, IntoEdges};
-use visit::{NodeCompactIndexable, IntoNodeIdentifiers, Visitable};
-use visit::{Data, IntoEdgeReferences, NodeCount, GraphProp};
+use crate::visit::{EdgeRef, GraphBase, IntoNeighbors, NodeIndexable, IntoEdges};
+use crate::visit::{NodeCompactIndexable, IntoNodeIdentifiers, Visitable};
+use crate::visit::{Data, IntoEdgeReferences, NodeCount, GraphProp};
-use util::zip;
+use crate::util::zip;
#[doc(no_inline)]
-pub use graph::{IndexType, DefaultIx};
+pub use crate::graph::{IndexType, DefaultIx};
-use {
+use crate::{
EdgeType,
Directed,
IntoWeightedEdge,
@@ -701,11 +701,11 @@
#[cfg(test)]
mod tests {
use super::Csr;
- use Undirected;
- use visit::Dfs;
- use visit::VisitMap;
- use algo::tarjan_scc;
- use algo::bellman_ford;
+ use crate::Undirected;
+ use crate::visit::Dfs;
+ use crate::visit::VisitMap;
+ use crate::algo::tarjan_scc;
+ use crate::algo::bellman_ford;
#[test]
fn csr1() {
@@ -889,8 +889,8 @@
#[test]
fn test_edge_references() {
- use visit::EdgeRef;
- use visit::IntoEdgeReferences;
+ use crate::visit::EdgeRef;
+ use crate::visit::IntoEdgeReferences;
let m: Csr<(), _> = Csr::from_sorted_edges(&[
(0, 1, 0.5),
(0, 2, 2.),
diff --git a/src/data.rs b/src/data.rs
index 1509461..03f1b31 100644
--- a/src/data.rs
+++ b/src/data.rs
@@ -1,16 +1,16 @@
//! Graph traits for associated data and graph construction.
-use Graph;
+use crate::Graph;
#[cfg(feature = "stable_graph")]
-use stable_graph::StableGraph;
-use ::{
+use crate::stable_graph::StableGraph;
+use crate::{
EdgeType,
};
-use graph::IndexType;
+use crate::graph::IndexType;
#[cfg(feature = "graphmap")]
-use graphmap::{GraphMap, NodeTrait};
-use visit::{
+use crate::graphmap::{GraphMap, NodeTrait};
+use crate::visit::{
Data,
NodeCount,
NodeIndexable,
diff --git a/src/dijkstra.rs b/src/dijkstra.rs
index e7b6feb..dd49cf9 100644
--- a/src/dijkstra.rs
+++ b/src/dijkstra.rs
@@ -9,14 +9,14 @@
use std::hash::Hash;
-use scored::MinScored;
+use crate::scored::MinScored;
use super::visit::{
Visitable,
VisitMap,
IntoEdges,
EdgeRef,
};
-use algo::Measure;
+use crate::algo::Measure;
/// [Generic] Dijkstra's shortest path algorithm.
///
diff --git a/src/dot.rs b/src/dot.rs
index 671338b..08f9d17 100644
--- a/src/dot.rs
+++ b/src/dot.rs
@@ -2,7 +2,7 @@
use std::fmt::{self, Display, Write};
-use visit::{GraphRef};
+use crate::visit::{GraphRef};
/// `Dot` implements output to graphviz .dot format for a graph.
///
@@ -86,8 +86,8 @@
_Incomplete(()),
}
-use visit::{ IntoNodeReferences, NodeIndexable, IntoEdgeReferences, EdgeRef};
-use visit::{ Data, NodeRef, GraphProp, };
+use crate::visit::{ IntoNodeReferences, NodeIndexable, IntoEdgeReferences, EdgeRef};
+use crate::visit::{ Data, NodeRef, GraphProp, };
impl<'a, G> Dot<'a, G>
{
diff --git a/src/generate.rs b/src/generate.rs
index 91ea64a..e717239 100644
--- a/src/generate.rs
+++ b/src/generate.rs
@@ -3,8 +3,8 @@
//! ***Unstable: API may change at any time.*** Depends on `feature = "generate"`.
//!
-use {Graph, Directed, EdgeType};
-use graph::NodeIndex;
+use crate::{Graph, Directed, EdgeType};
+use crate::graph::NodeIndex;
// A DAG has the property that the adjacency matrix is lower triangular,
// diagonal zero.
diff --git a/src/graph_impl/frozen.rs b/src/graph_impl/frozen.rs
index 488cc55..bb96618 100644
--- a/src/graph_impl/frozen.rs
+++ b/src/graph_impl/frozen.rs
@@ -1,17 +1,17 @@
use std::ops::{Deref, Index, IndexMut};
-use graph::Graph;
+use crate::graph::Graph;
use super::Frozen;
-use graph::{IndexType, GraphIndex};
-use {
+use crate::graph::{IndexType, GraphIndex};
+use crate::{
Direction,
EdgeType,
};
-use visit::{Data, IntoNodeIdentifiers, GraphProp, NodeIndexable, IntoNeighborsDirected};
-use visit::{IntoNeighbors, IntoNodeReferences, IntoEdgeReferences, Visitable};
-use visit::{NodeCompactIndexable, GetAdjacencyMatrix, NodeCount, IntoEdges, IntoEdgesDirected};
-use data::{DataMap, DataMapMut};
+use crate::visit::{Data, IntoNodeIdentifiers, GraphProp, NodeIndexable, IntoNeighborsDirected};
+use crate::visit::{IntoNeighbors, IntoNodeReferences, IntoEdgeReferences, Visitable};
+use crate::visit::{NodeCompactIndexable, GetAdjacencyMatrix, NodeCount, IntoEdges, IntoEdgesDirected};
+use crate::data::{DataMap, DataMapMut};
impl<'a, G> Frozen<'a, G> {
diff --git a/src/graph_impl/mod.rs b/src/graph_impl/mod.rs
index 9ba5310..3436bb1 100644
--- a/src/graph_impl/mod.rs
+++ b/src/graph_impl/mod.rs
@@ -7,7 +7,7 @@
use std::ops::{Index, IndexMut, Range};
use std::slice;
-use {
+use crate::{
Direction, Outgoing, Incoming,
Undirected,
Directed,
@@ -15,15 +15,15 @@
IntoWeightedEdge,
};
-use iter_format::{
+use crate::iter_format::{
IterFormatExt,
NoPretty,
DebugMap,
};
-use visit::EdgeRef;
-use visit::{IntoNodeReferences, IntoEdges, IntoEdgesDirected};
-use util::enumerate;
+use crate::visit::EdgeRef;
+use crate::visit::{IntoNodeReferences, IntoEdges, IntoEdgesDirected};
+use crate::util::enumerate;
#[cfg(feature = "serde-1")]
mod serialization;
diff --git a/src/graph_impl/serialization.rs b/src/graph_impl/serialization.rs
index c400693..8c93c2e 100644
--- a/src/graph_impl/serialization.rs
+++ b/src/graph_impl/serialization.rs
@@ -3,14 +3,14 @@
use std::marker::PhantomData;
-use prelude::*;
+use crate::prelude::*;
-use EdgeType;
-use graph::Node;
-use graph::{IndexType, Edge};
-use serde_utils::MappedSequenceVisitor;
-use serde_utils::CollectSeqWithLength;
-use serde_utils::{IntoSerializable, FromDeserialized};
+use crate::EdgeType;
+use crate::graph::Node;
+use crate::graph::{IndexType, Edge};
+use crate::serde_utils::MappedSequenceVisitor;
+use crate::serde_utils::CollectSeqWithLength;
+use crate::serde_utils::{IntoSerializable, FromDeserialized};
use super::{NodeIndex, EdgeIndex};
use serde::{Serialize, Serializer, Deserialize, Deserializer};
diff --git a/src/graph_impl/stable_graph/mod.rs b/src/graph_impl/stable_graph/mod.rs
index 293efaa..1f6094d 100644
--- a/src/graph_impl/stable_graph/mod.rs
+++ b/src/graph_impl/stable_graph/mod.rs
@@ -12,7 +12,7 @@
use std::ops::{Index, IndexMut};
use std::slice;
-use {
+use crate::{
Graph,
EdgeType,
Directed,
@@ -22,12 +22,12 @@
Outgoing,
};
-use iter_format::{
+use crate::iter_format::{
IterFormatExt,
NoPretty,
DebugMap,
};
-use iter_utils::IterUtilsExt;
+use crate::iter_utils::IterUtilsExt;
use super::{
Edge,
@@ -37,8 +37,8 @@
Pair,
Frozen,
};
-use IntoWeightedEdge;
-use visit::{
+use crate::IntoWeightedEdge;
+use crate::visit::{
EdgeRef,
IntoNodeReferences,
IntoEdges,
@@ -49,7 +49,7 @@
// reexport those things that are shared with Graph
#[doc(no_inline)]
-pub use graph::{
+pub use crate::graph::{
NodeIndex,
EdgeIndex,
GraphIndex,
@@ -59,7 +59,7 @@
edge_index,
};
-use util::enumerate;
+use crate::util::enumerate;
#[cfg(feature = "serde-1")]
mod serialization;
@@ -1682,7 +1682,7 @@
#[test]
fn dfs() {
- use visit::Dfs;
+ use crate::visit::Dfs;
let mut gr = StableGraph::<_, _>::with_capacity(0, 0);
let a = gr.add_node("a");
diff --git a/src/graph_impl/stable_graph/serialization.rs b/src/graph_impl/stable_graph/serialization.rs
index bc26c57..da031c6 100644
--- a/src/graph_impl/stable_graph/serialization.rs
+++ b/src/graph_impl/stable_graph/serialization.rs
@@ -5,17 +5,17 @@
use std::marker::PhantomData;
-use prelude::*;
+use crate::prelude::*;
-use EdgeType;
-use graph::Node;
-use graph::{IndexType, Edge};
-use stable_graph::StableGraph;
-use util::rev;
-use serde_utils::MappedSequenceVisitor;
-use serde_utils::CollectSeqWithLength;
-use serde_utils::{IntoSerializable, FromDeserialized};
-use visit::NodeIndexable;
+use crate::EdgeType;
+use crate::graph::Node;
+use crate::graph::{IndexType, Edge};
+use crate::stable_graph::StableGraph;
+use crate::util::rev;
+use crate::serde_utils::MappedSequenceVisitor;
+use crate::serde_utils::CollectSeqWithLength;
+use crate::serde_utils::{IntoSerializable, FromDeserialized};
+use crate::visit::NodeIndexable;
use super::super::serialization::{EdgeProperty, invalid_length_err, invalid_node_err};
@@ -231,8 +231,8 @@
#[test]
fn test_from_deserialized_with_holes() {
- use graph::node_index;
- use stable_graph::StableUnGraph;
+ use crate::graph::node_index;
+ use crate::stable_graph::StableUnGraph;
use serde::de::value::Error as SerdeError;
use itertools::assert_equal;
diff --git a/src/graphmap.rs b/src/graphmap.rs
index 5adac89..8a4d97c 100644
--- a/src/graphmap.rs
+++ b/src/graphmap.rs
@@ -20,7 +20,7 @@
};
use indexmap::map::Keys;
-use {
+use crate::{
EdgeType,
Directed,
Undirected,
@@ -29,11 +29,11 @@
Outgoing,
};
-use IntoWeightedEdge;
-use visit::{IntoNodeIdentifiers, NodeCount, IntoNodeReferences, NodeIndexable};
-use visit::{NodeCompactIndexable, IntoEdgeReferences, IntoEdges};
-use graph::Graph;
-use graph::node_index;
+use crate::IntoWeightedEdge;
+use crate::visit::{IntoNodeIdentifiers, NodeCount, IntoNodeReferences, NodeIndexable};
+use crate::visit::{NodeCompactIndexable, IntoEdgeReferences, IntoEdges};
+use crate::graph::Graph;
+use crate::graph::node_index;
/// A `GraphMap` with undirected edges.
///
@@ -414,7 +414,7 @@
/// **Panics** if the number of nodes or edges does not fit with
/// the resulting graph's index type.
pub fn into_graph<Ix>(self) -> Graph<N, E, Ty, Ix>
- where Ix: ::graph::IndexType,
+ where Ix: crate::graph::IndexType,
{
// assuming two successive iterations of the same hashmap produce the same order
let mut gr = Graph::with_capacity(self.node_count(), self.edge_count());
diff --git a/src/lib.rs b/src/lib.rs
index 7c6f82a..5febc29 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,9 +31,9 @@
extern crate itertools;
#[doc(no_inline)]
-pub use graph::Graph;
+pub use crate::graph::Graph;
-pub use Direction::{Outgoing, Incoming};
+pub use crate::Direction::{Outgoing, Incoming};
#[macro_use]
mod macros;
@@ -70,7 +70,7 @@
/// `Graph<N, E, Ty, Ix>` is a graph datastructure using an adjacency list representation.
pub mod graph {
- pub use graph_impl::{
+ pub use crate::graph_impl::{
Edge,
EdgeIndex,
EdgeIndices,
@@ -99,7 +99,7 @@
}
#[cfg(feature = "stable_graph")]
-pub use graph_impl::stable_graph;
+pub use crate::graph_impl::stable_graph;
macro_rules! copyclone {
($name:ident) => {
@@ -141,7 +141,7 @@
}
#[doc(hidden)]
-pub use Direction as EdgeDirection;
+pub use crate::Direction as EdgeDirection;
/// Marker type for a directed graph.
#[derive(Copy, Debug)]
diff --git a/src/prelude.rs b/src/prelude.rs
index 51602c9..d35161e 100644
--- a/src/prelude.rs
+++ b/src/prelude.rs
@@ -6,7 +6,7 @@
//! ```
#[doc(no_inline)]
-pub use graph::{
+pub use crate::graph::{
Graph,
NodeIndex,
EdgeIndex,
@@ -15,26 +15,26 @@
};
#[cfg(feature = "graphmap")]
#[doc(no_inline)]
-pub use graphmap::{
+pub use crate::graphmap::{
GraphMap,
DiGraphMap,
UnGraphMap,
};
#[doc(no_inline)]
#[cfg(feature = "stable_graph")]
-pub use stable_graph::{
+pub use crate::stable_graph::{
StableGraph,
StableDiGraph,
StableUnGraph,
};
#[doc(no_inline)]
-pub use visit::{
+pub use crate::visit::{
Bfs,
Dfs,
DfsPostOrder,
};
#[doc(no_inline)]
-pub use ::{
+pub use crate::{
Direction,
Incoming,
Outgoing,
@@ -43,6 +43,6 @@
};
#[doc(no_inline)]
-pub use visit::{
+pub use crate::visit::{
EdgeRef,
};
diff --git a/src/quickcheck.rs b/src/quickcheck.rs
index d4dd00f..7ce6cad 100644
--- a/src/quickcheck.rs
+++ b/src/quickcheck.rs
@@ -1,23 +1,23 @@
extern crate quickcheck;
use self::quickcheck::{Gen, Arbitrary};
-use {
+use crate::{
Graph,
EdgeType,
};
-use graph::{
+use crate::graph::{
IndexType,
node_index,
};
#[cfg(feature = "stable_graph")]
-use stable_graph::StableGraph;
+use crate::stable_graph::StableGraph;
#[cfg(feature = "graphmap")]
-use graphmap::{
+use crate::graphmap::{
GraphMap,
NodeTrait,
};
-use visit::NodeIndexable;
+use crate::visit::NodeIndexable;
/// Return a random float in the range [0, 1.)
fn random_01<G: Gen>(g: &mut G) -> f64 {
diff --git a/src/traits_graph.rs b/src/traits_graph.rs
index 90e5fba..1eef177 100644
--- a/src/traits_graph.rs
+++ b/src/traits_graph.rs
@@ -11,10 +11,10 @@
NodeIndex,
};
#[cfg(feature = "stable_graph")]
-use stable_graph::StableGraph;
+use crate::stable_graph::StableGraph;
#[cfg(feature = "stable_graph")]
-use visit::{NodeIndexable, IntoEdgeReferences};
-use visit::EdgeRef;
+use crate::visit::{NodeIndexable, IntoEdgeReferences};
+use crate::visit::EdgeRef;
use super::visit::GetAdjacencyMatrix;
diff --git a/src/visit/dfsvisit.rs b/src/visit/dfsvisit.rs
index 79df937..049118b 100644
--- a/src/visit/dfsvisit.rs
+++ b/src/visit/dfsvisit.rs
@@ -1,7 +1,7 @@
-use visit::IntoNeighbors;
-use visit::{VisitMap, Visitable};
+use crate::visit::IntoNeighbors;
+use crate::visit::{VisitMap, Visitable};
/// Strictly monotonically increasing event time for a depth first search.
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Default, Hash)]
diff --git a/src/visit/filter.rs b/src/visit/filter.rs
index cb64c79..7f7c568 100644
--- a/src/visit/filter.rs
+++ b/src/visit/filter.rs
@@ -1,11 +1,11 @@
-use prelude::*;
+use crate::prelude::*;
use fixedbitset::FixedBitSet;
use std::collections::HashSet;
use std::marker::PhantomData;
-use visit::{
+use crate::visit::{
GraphBase,
GraphProp,
IntoEdgeReferences,
@@ -20,8 +20,8 @@
VisitMap,
Visitable,
};
-use visit::{Data, NodeCompactIndexable, NodeCount};
-use data::{DataMap};
+use crate::visit::{Data, NodeCompactIndexable, NodeCount};
+use crate::data::{DataMap};
/// A graph filter for nodes.
pub trait FilterNode<N>
diff --git a/src/visit/mod.rs b/src/visit/mod.rs
index 7383497..d9351f9 100644
--- a/src/visit/mod.rs
+++ b/src/visit/mod.rs
@@ -55,26 +55,26 @@
};
use std::hash::{Hash, BuildHasher};
-use prelude::{Graph, Direction};
+use crate::prelude::{Graph, Direction};
#[cfg(feature = "graphmap")]
-use prelude::GraphMap;
+use crate::prelude::GraphMap;
#[cfg(feature = "stable_graph")]
-use prelude::StableGraph;
-use graph::{NodeIndex};
+use crate::prelude::StableGraph;
+use crate::graph::{NodeIndex};
use super::{
graph,
EdgeType,
};
-use graph::{
+use crate::graph::{
IndexType,
};
#[cfg(feature = "stable_graph")]
-use stable_graph;
-use graph::Frozen;
+use crate::stable_graph;
+use crate::graph::Frozen;
#[cfg(feature = "graphmap")]
-use graphmap::{
+use crate::graphmap::{
self,
NodeTrait,
};
diff --git a/src/visit/reversed.rs b/src/visit/reversed.rs
index 9380aa3..29c6d48 100644
--- a/src/visit/reversed.rs
+++ b/src/visit/reversed.rs
@@ -1,10 +1,10 @@
-use ::{
+use crate::{
Direction,
Incoming,
};
-use visit::{
+use crate::visit::{
GraphBase,
GraphRef,
IntoNodeIdentifiers,
diff --git a/src/visit/traversal.rs b/src/visit/traversal.rs
index d48d083..3a40e7c 100644
--- a/src/visit/traversal.rs
+++ b/src/visit/traversal.rs
@@ -1,5 +1,5 @@
-use {Incoming};
+use crate::{Incoming};
use super::{IntoNeighbors, IntoNeighborsDirected, Visitable, VisitMap};
use super::{GraphRef, Reversed, IntoNodeIdentifiers};
use std::collections::VecDeque;