Safely get data in matrix Debug formatting

This commit is contained in:
Owen Brooks 2022-06-17 17:43:38 +10:00
parent 2dd76fd86e
commit 699d57d9dd

View File

@ -210,10 +210,7 @@ impl<T: fmt::Debug, R: Dim, C: Dim, S: RawStorage<T, R, C> + fmt::Debug> fmt::De
if j != 0 {
write!(f, ", ")?;
}
// Safety: the indices are within range
unsafe {
(*self.data.get_unchecked(i, j)).fmt(f)?;
}
self[(i, j)].fmt(f)?;
}
if i != nrows - 1 {
write!(f, "; ")?;