From f2cb2f72e70b9058560694f5a645679dd00f8320 Mon Sep 17 00:00:00 2001 From: Egor Duda Date: Sun, 5 Jun 2022 22:39:13 +0300 Subject: [PATCH] Use StorageError::CustomError for implementations-specific (I/O) errors --- libraries/persistent_store/src/storage.rs | 11 +++-------- libraries/persistent_store/src/store.rs | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/libraries/persistent_store/src/storage.rs b/libraries/persistent_store/src/storage.rs index d0a0659..473965b 100644 --- a/libraries/persistent_store/src/storage.rs +++ b/libraries/persistent_store/src/storage.rs @@ -34,17 +34,12 @@ pub enum StorageError { /// Implementation-specific error. CustomError, - - // I/O error - #[cfg(feature = "hostenv")] - IOError, } -#[cfg(feature = "hostenv")] -#[allow(unused_variables)] +#[cfg(feature = "std")] impl From for StorageError { - fn from(error: std::io::Error) -> Self { - Self::IOError + fn from(_: std::io::Error) -> Self { + Self::CustomError } } diff --git a/libraries/persistent_store/src/store.rs b/libraries/persistent_store/src/store.rs index ebaf806..b946878 100644 --- a/libraries/persistent_store/src/store.rs +++ b/libraries/persistent_store/src/store.rs @@ -72,8 +72,6 @@ impl From for StoreError { fn from(error: StorageError) -> StoreError { match error { StorageError::CustomError => StoreError::StorageError, - #[cfg(feature = "hostenv")] - StorageError::IOError => StoreError::StorageError, // The store always calls the storage correctly. StorageError::NotAligned | StorageError::OutOfBounds => unreachable!(), }