Skip to content

Commit

Permalink
rename convert_error to impl_from in core
Browse files Browse the repository at this point in the history
  • Loading branch information
pkhry committed May 23, 2024
1 parent c474c27 commit e6b6394
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ impl core::fmt::Display for Error {
#[cfg(feature = "std")]
impl std::error::Error for Error {}

convert_error!(ExtrinsicParamsError as Error::ExtrinsicParams);
convert_error!(BlockError as Error::Block);
convert_error!(MetadataError as Error::Metadata);
convert_error!(scale_decode::Error as Error::Decode);
convert_error!(scale_decode::visitor::DecodeError as Error::Decode);
convert_error!(scale_encode::Error as Error::Encode);
convert_error!(StorageAddressError as Error::StorageAddress);
convert_error!(codec::Error as Error::Codec);
impl_from!(ExtrinsicParamsError => Error::ExtrinsicParams);
impl_from!(BlockError => Error::Block);
impl_from!(MetadataError => Error::Metadata);
impl_from!(scale_decode::Error => Error::Decode);
impl_from!(scale_decode::visitor::DecodeError => Error::Decode);
impl_from!(scale_encode::Error => Error::Encode);
impl_from!(StorageAddressError => Error::StorageAddress);
impl_from!(codec::Error => Error::Codec);

/// Block error
#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down
4 changes: 2 additions & 2 deletions core/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ macro_rules! cfg_substrate_compat {
};
}

macro_rules! convert_error {
($module_path:path as $delegate_ty:ident :: $variant:ident) => {
macro_rules! impl_from {
($module_path:path => $delegate_ty:ident :: $variant:ident) => {
impl From<$module_path> for $delegate_ty {
fn from(val: $module_path) -> Self {
$delegate_ty::$variant(val.into())
Expand Down

0 comments on commit e6b6394

Please sign in to comment.