Skip to content

Commit

Permalink
refactor/tensor: remove unused error types
Browse files Browse the repository at this point in the history
During refactoring (autumnai#37) several error were upgraded into panics. Those
errors may happen only if internal logic of `SharedTensor` is incorrect
and leads to inconsistent state and broken invariants.
  • Loading branch information
alexandermorozov committed Apr 18, 2016
1 parent 533f7b0 commit 208ae6d
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,6 @@ impl<T> SharedTensor<T> {
/// Errors than can occur when synchronizing memory.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Error {
/// No copy on source device.
MissingSource(&'static str),
/// No copy on destination device.
MissingDestination(&'static str),
/// No valid MemoryType provided. Other than expected.
InvalidMemory(&'static str),
/// No memory allocation on specified device happened.
InvalidMemoryAllocation(&'static str),
/// Unable to remove Memory copy from SharedTensor.
InvalidRemove(&'static str),
/// Framework error at memory allocation.
Expand All @@ -526,10 +518,6 @@ impl fmt::Display for Error {
impl error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::MissingSource(ref err) => err,
Error::MissingDestination(ref err) => err,
Error::InvalidMemory(ref err) => err,
Error::InvalidMemoryAllocation(ref err) => err,
Error::InvalidRemove(ref err) => err,
Error::MemoryAllocationError(ref err) => err.description(),
Error::MemorySynchronizationError(ref err) => err.description(),
Expand All @@ -543,10 +531,6 @@ impl error::Error for Error {

fn cause(&self) -> Option<&error::Error> {
match *self {
Error::MissingSource(_) => None,
Error::MissingDestination(_) => None,
Error::InvalidMemory(_) => None,
Error::InvalidMemoryAllocation(_) => None,
Error::InvalidRemove(_) => None,
Error::MemoryAllocationError(ref err) => Some(err),
Error::MemorySynchronizationError(ref err) => Some(err),
Expand Down

0 comments on commit 208ae6d

Please sign in to comment.