From 78d280b8678af7fb8006f61d3349dea0f5e3bda1 Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Mon, 30 Dec 2024 21:02:27 +0400 Subject: [PATCH] chore: move derive_more to dev-deps --- Cargo.toml | 3 +-- src/errors.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5509341..345f31e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,6 @@ quick-xml = ["serde?/derive", "serde?/alloc"] # FIXME: quick-xml#473 serde = { version = "1.0", default-features = false, optional = true } schemars = { version = "0.8", default-features = false, optional = true } typenum = "1.12.0" -derive_more = { version = "0.99.9", default-features = false } parity-scale-codec = { version = "3", default-features = false, optional = true } static_assertions = "1.1.0" itoa = "1.0.1" @@ -56,7 +55,7 @@ i256 = { version = "=0.1.1", default-features = false, optional = true } anyhow = { version = "1.0.38", default-features = false } colored = "2.0.0" criterion = "0.5" -derive_more = "0.99.9" +derive_more = { version = "1.0.0", features = ["full"] } trybuild = "1.0.85" serde_json = "1" proptest = "1.0.0" diff --git a/src/errors.rs b/src/errors.rs index 6d63cf4..ca487eb 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,10 +1,11 @@ use core::fmt::{Display, Formatter, Result}; +// TODO: once MSRV becomes 1.81, use `core::error::Error` instead. +// Also, enable doctests in CI checks even for no-std. #[cfg(feature = "std")] -use derive_more::Error; +use std::error::Error; /// Represents errors during arithmetic operations. -#[cfg_attr(feature = "std", derive(Error))] #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum ArithmeticError { @@ -34,8 +35,10 @@ impl Display for ArithmeticError { } } +#[cfg(feature = "std")] +impl Error for ArithmeticError {} + /// Represents errors during conversions. -#[cfg_attr(feature = "std", derive(Error))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct ConvertError { reason: &'static str, @@ -57,3 +60,6 @@ impl Display for ConvertError { f.write_str(self.as_str()) } } + +#[cfg(feature = "std")] +impl Error for ConvertError {}