Fix possible overflow in matrix debug formatting
This commit is contained in:
parent
364302d072
commit
e70bcdbe22
|
@ -203,20 +203,21 @@ impl<T: fmt::Debug, R: Dim, C: Dim, S: RawStorage<T, R, C> + fmt::Debug> fmt::De
|
||||||
writeln!(f, "")?;
|
writeln!(f, "")?;
|
||||||
}
|
}
|
||||||
write!(f, "[")?;
|
write!(f, "[")?;
|
||||||
let nrows = self.nrows();
|
|
||||||
let ncols = self.ncols();
|
let row_separator = match f.alternate() {
|
||||||
for i in 0..nrows {
|
true => ";\n ",
|
||||||
for j in 0..ncols {
|
false => "; ",
|
||||||
if j != 0 {
|
};
|
||||||
|
|
||||||
|
for (i, row) in self.row_iter().enumerate() {
|
||||||
|
if i > 0 {
|
||||||
|
write!(f, "{row_separator}")?;
|
||||||
|
}
|
||||||
|
for (j, element) in row.iter().enumerate() {
|
||||||
|
if j > 0 {
|
||||||
write!(f, ", ")?;
|
write!(f, ", ")?;
|
||||||
}
|
}
|
||||||
self[(i, j)].fmt(f)?;
|
element.fmt(f)?;
|
||||||
}
|
|
||||||
if i != nrows - 1 {
|
|
||||||
write!(f, "; ")?;
|
|
||||||
}
|
|
||||||
if f.alternate() && i != nrows - 1 {
|
|
||||||
write!(f, "\n ")?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write!(f, "]")
|
write!(f, "]")
|
||||||
|
|
Loading…
Reference in New Issue