Commit a2f627e9 authored by dvshapkin's avatar dvshapkin
Browse files

исправлена ошибка

parent 6ac22af8
......@@ -161,6 +161,9 @@ where
type Output = [T];
fn index(&self, row: usize) -> &Self::Output {
if row >= self.rows() {
panic!("index out of bounds")
}
&self.buffer[row * self.cols..(row + 1) * self.cols]
}
}
......@@ -170,6 +173,9 @@ where
T: Default + Clone,
{
fn index_mut(&mut self, row: usize) -> &mut Self::Output {
if row >= self.rows() {
panic!("index out of bounds")
}
&mut self.buffer[row * self.cols..(row + 1) * self.cols]
}
}
......@@ -225,7 +231,7 @@ where
/// Performs addition of two matrices.
/// Panics, if the sizes of the operands do not match.
fn add(self, other: Self) -> Self {
if ! self.is_same_size(&other) {
if !self.is_same_size(&other) {
panic!("operands vary in size");
}
let result = Self::new(self.rows(), self.cols());
......@@ -245,7 +251,7 @@ where
/// Performs subtraction of two matrices.
/// Panics, if the sizes of the operands do not match.
fn sub(self, other: Self) -> Self {
if ! self.is_same_size(&other) {
if !self.is_same_size(&other) {
panic!("operands vary in size");
}
let result = Self::new(self.rows(), self.cols());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment