From 97e2a8ff44468fc0b129ab88a86313a93470e5b9 Mon Sep 17 00:00:00 2001 From: Owen Brooks Date: Wed, 15 Jun 2022 20:14:37 +1000 Subject: [PATCH] Simplify Matrix Debug output --- src/base/matrix.rs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/base/matrix.rs b/src/base/matrix.rs index f1417d39..37fc8b14 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -199,11 +199,10 @@ impl + fmt::Debug> fmt::De for Matrix { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { - write!(f, "Matrix {{ ")?; if f.alternate() { - write!(f, "\n ")?; + writeln!(f, "")?; } - write!(f, "data: [")?; + write!(f, "[")?; let nrows = self.nrows(); let ncols = self.ncols(); for i in 0..nrows { @@ -220,22 +219,10 @@ impl + fmt::Debug> fmt::De write!(f, "; ")?; } if f.alternate() && i != nrows - 1 { - write!(f, "\n ")?; + write!(f, "\n ")?; } } - write!(f, "], ")?; - if f.alternate() { - write!(f, "\n ")?; - } - write!(f, "nrows: {:?}, ", nrows)?; - if f.alternate() { - write!(f, "\n ")?; - } - write!(f, "ncols: {:?} ", ncols)?; - if f.alternate() { - writeln!(f, "")?; - } - write!(f, "}}") + write!(f, "]") } } @@ -2028,9 +2015,7 @@ mod tests { ┌ ┐ │ 1e6 2e5 │ │ 2e-5 1e0 │ - └ ┘ - -" + └ ┘" ) } }