about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-10-10 20:08:20 +0800
committerkennytm <kennytm@gmail.com>2017-10-10 22:43:57 +0800
commit23a99f4e0e47025e949c6a68796afdf3a0d441ad (patch)
tree744eb8e8d28bdc35beda4baa037c8e547f02a7ee /src/librustc_data_structures
parent0217315bf23edee385a7042b5a23b3e7e376820c (diff)
parent679457ad2a0f33aed6b206107afedcccf5124374 (diff)
downloadrust-23a99f4e0e47025e949c6a68796afdf3a0d441ad.tar.gz
rust-23a99f4e0e47025e949c6a68796afdf3a0d441ad.zip
Rollup merge of #44775 - MaloJaffre:debug-struct, r=sfackler
Refactor to use `debug_struct` in several Debug impls

Also use `pad` and derive `Debug` for `Edge`.

Fixes #44771.
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/graph/mod.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/librustc_data_structures/graph/mod.rs b/src/librustc_data_structures/graph/mod.rs
index 474622f3669..56d5f5ffa3f 100644
--- a/src/librustc_data_structures/graph/mod.rs
+++ b/src/librustc_data_structures/graph/mod.rs
@@ -31,7 +31,7 @@
 //! be indexed by the direction (see the type `Direction`).
 
 use bitvec::BitVector;
-use std::fmt::{Formatter, Error, Debug};
+use std::fmt::Debug;
 use std::usize;
 use snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
 
@@ -48,6 +48,7 @@ pub struct Node<N> {
     pub data: N,
 }
 
+#[derive(Debug)]
 pub struct Edge<E> {
     next_edge: [EdgeIndex; 2], // see module comment
     source: NodeIndex,
@@ -69,18 +70,6 @@ impl<N> SnapshotVecDelegate for Edge<N> {
     fn reverse(_: &mut Vec<Edge<N>>, _: ()) {}
 }
 
-impl<E: Debug> Debug for Edge<E> {
-    fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
-        write!(f,
-               "Edge {{ next_edge: [{:?}, {:?}], source: {:?}, target: {:?}, data: {:?} }}",
-               self.next_edge[0],
-               self.next_edge[1],
-               self.source,
-               self.target,
-               self.data)
-    }
-}
-
 #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
 pub struct NodeIndex(pub usize);