Skip to content

Commit

Permalink
chore: move derive_more to dev-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
loyd committed Dec 30, 2024
1 parent d2757c8 commit 78d280b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
12 changes: 9 additions & 3 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -57,3 +60,6 @@ impl Display for ConvertError {
f.write_str(self.as_str())
}
}

#[cfg(feature = "std")]
impl Error for ConvertError {}

0 comments on commit 78d280b

Please sign in to comment.