Skip to content

Commit 19fba19

Browse files
committed
Use Result
1 parent 0c2ba52 commit 19fba19

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::error;
44
use std::fmt;
55
use ndarray::{Ixs, ShapeError};
66

7-
pub type LResult<T> = Result<T, LinalgError>;
7+
pub type Result<T> = ::std::result::Result<T, LinalgError>;
88

99
#[derive(Debug, EnumError)]
1010
pub enum LinalgError {

src/layout.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ impl Layout {
2323
}
2424
}
2525

26-
pub fn ffi_size(&self) -> (Col_, Row_) {
26+
pub fn ffi_size(&self) -> (Row_, Col_) {
2727
let (n, m) = self.size();
28-
(m as Col_, n as Row_)
28+
(n as Row_, m as Col_)
2929
}
3030

3131
pub fn ffi_layout(&self) -> Layout_ {
@@ -38,17 +38,17 @@ impl Layout {
3838

3939
pub trait AllocatedArray2D {
4040
type Scalar;
41-
fn layout(&self) -> LResult<Layout>;
42-
fn square_layout(&self) -> LResult<Layout>;
43-
fn as_allocated(&self) -> LResult<&[Self::Scalar]>;
41+
fn layout(&self) -> Result<Layout>;
42+
fn square_layout(&self) -> Result<Layout>;
43+
fn as_allocated(&self) -> Result<&[Self::Scalar]>;
4444
}
4545

4646
impl<A, S> AllocatedArray2D for ArrayBase<S, Ix2>
4747
where S: Data<Elem = A>
4848
{
4949
type Scalar = A;
5050

51-
fn layout(&self) -> LResult<Layout> {
51+
fn layout(&self) -> Result<Layout> {
5252
let strides = self.strides();
5353
if ::std::cmp::min(strides[0], strides[1]) != 1 {
5454
return Err(StrideError::new(strides[0], strides[1]).into());
@@ -60,7 +60,7 @@ impl<A, S> AllocatedArray2D for ArrayBase<S, Ix2>
6060
}
6161
}
6262

63-
fn square_layout(&self) -> LResult<Layout> {
63+
fn square_layout(&self) -> Result<Layout> {
6464
let l = self.layout()?;
6565
let (n, m) = l.size();
6666
if n == m {
@@ -70,7 +70,7 @@ impl<A, S> AllocatedArray2D for ArrayBase<S, Ix2>
7070
}
7171
}
7272

73-
fn as_allocated(&self) -> LResult<&[A]> {
73+
fn as_allocated(&self) -> Result<&[A]> {
7474
let slice = self.as_slice_memory_order().ok_or(MemoryContError::new())?;
7575
Ok(slice)
7676
}

0 commit comments

Comments
 (0)