Skip to content

Commit

Permalink
chore(deps): bump derive_more from 0.99 to 1.0.0 (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 authored Oct 21, 2024
1 parent 0fcccc1 commit 92685e8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion scale-decode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ scale-bits = { version = "0.6.0", default-features = false }
scale-decode-derive = { workspace = true, optional = true }
primitive-types = { version = "0.12.0", optional = true, default-features = false }
smallvec = "1.10.0"
derive_more = { version = "0.99.17", default-features = false, features = ["from", "display"] }
derive_more = { version = "1.0.0", default-features = false, features = ["from", "display"] }
scale-type-resolver = { version = "0.2.0", default-features = false }

[dev-dependencies]
Expand Down
12 changes: 6 additions & 6 deletions scale-decode/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ pub enum ErrorKind {
/// Something went wrong decoding the bytes based on the type
/// and type registry provided.
#[from]
#[display(fmt = "Error decoding bytes given the type ID and registry provided: {_0}")]
#[display("Error decoding bytes given the type ID and registry provided: {_0}")]
VisitorDecodeError(DecodeError),
/// We cannot decode the number seen into the target type; it's out of range.
#[display(fmt = "Number {value} is out of range")]
#[display("Number {value} is out of range")]
NumberOutOfRange {
/// A string representation of the numeric value that was out of range.
value: String,
},
/// We cannot find the variant we're trying to decode from in the target type.
#[display(fmt = "Cannot find variant {got}; expects one of {expected:?}")]
#[display("Cannot find variant {got}; expects one of {expected:?}")]
CannotFindVariant {
/// The variant that we are given back from the encoded bytes.
got: String,
Expand All @@ -134,7 +134,7 @@ pub enum ErrorKind {
},
/// The types line up, but the expected length of the target type is different from the length of the input value.
#[display(
fmt = "Cannot decode from type; expected length {expected_len} but got length {actual_len}"
"Cannot decode from type; expected length {expected_len} but got length {actual_len}"
)]
WrongLength {
/// Length of the type we are trying to decode from
Expand All @@ -143,14 +143,14 @@ pub enum ErrorKind {
expected_len: usize,
},
/// Cannot find a field that we need to decode to our target type
#[display(fmt = "Field {name} does not exist in our encoded data")]
#[display("Field {name} does not exist in our encoded data")]
CannotFindField {
/// Name of the field which was not provided.
name: String,
},
/// A custom error.
#[from]
#[display(fmt = "Custom error: {_0}")]
#[display("Custom error: {_0}")]
Custom(Box<dyn CustomError>),
}

Expand Down
58 changes: 29 additions & 29 deletions scale-decode/src/visitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,32 +244,32 @@ pub trait Visitor: Sized {
#[derive(Debug, Clone, PartialEq, Eq, derive_more::From, derive_more::Display)]
pub enum DecodeError {
/// Type ID was not found
#[display(fmt = "Could not find type with ID '{_0}'")]
#[display("Could not find type with ID '{_0}'")]
TypeIdNotFound(String),
/// A low level error trying to resolve a type.
#[display(fmt = "Failed to resolve type: {_0}")]
#[display("Failed to resolve type: {_0}")]
TypeResolvingError(String),
/// The type we're trying to decode is supposed to be compact encoded, but that is not possible.
#[display(fmt = "Could not decode compact encoded type: compact types can only have 1 field")]
#[display("Could not decode compact encoded type: compact types can only have 1 field")]
CannotDecodeCompactIntoType,
/// Failure to decode bytes into a string.
#[from]
#[display(fmt = "Could not decode string: {_0}")]
#[display("Could not decode string: {_0}")]
InvalidStr(alloc::str::Utf8Error),
/// We could not convert the [`u32`] that we found into a valid [`char`].
#[display(fmt = "{_0} is expected to be a valid char, but is not")]
#[display("{_0} is expected to be a valid char, but is not")]
InvalidChar(u32),
/// We expected more bytes to finish decoding, but could not find them.
#[display(fmt = "Ran out of data during decoding")]
#[display("Ran out of data during decoding")]
NotEnoughInput,
/// We found a variant that does not match with any in the type we're trying to decode from.
#[display(fmt = "Could not find variant with index {_0}")]
#[display("Could not find variant with index {_0}")]
VariantNotFound(u8),
/// Some error emitted from a [`codec::Decode`] impl.
#[from]
CodecError(codec::Error),
/// This is returned by default if a visitor function is not implemented.
#[display(fmt = "Unexpected type {_0}")]
#[display("Unexpected type {_0}")]
Unexpected(Unexpected),
}

Expand All @@ -280,47 +280,47 @@ impl std::error::Error for DecodeError {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, derive_more::Display)]
#[allow(missing_docs)]
pub enum Unexpected {
#[display(fmt = "bool")]
#[display("bool")]
Bool,
#[display(fmt = "char")]
#[display("char")]
Char,
#[display(fmt = "u8")]
#[display("u8")]
U8,
#[display(fmt = "u16")]
#[display("u16")]
U16,
#[display(fmt = "u32")]
#[display("u32")]
U32,
#[display(fmt = "u64")]
#[display("u64")]
U64,
#[display(fmt = "u128")]
#[display("u128")]
U128,
#[display(fmt = "u256")]
#[display("u256")]
U256,
#[display(fmt = "i8")]
#[display("i8")]
I8,
#[display(fmt = "i16")]
#[display("i16")]
I16,
#[display(fmt = "i32")]
#[display("i32")]
I32,
#[display(fmt = "i64")]
#[display("i64")]
I64,
#[display(fmt = "i128")]
#[display("i128")]
I128,
#[display(fmt = "i256")]
#[display("i256")]
I256,
#[display(fmt = "sequence")]
#[display("sequence")]
Sequence,
#[display(fmt = "composite")]
#[display("composite")]
Composite,
#[display(fmt = "tuple")]
#[display("tuple")]
Tuple,
#[display(fmt = "str")]
#[display("str")]
Str,
#[display(fmt = "variant")]
#[display("variant")]
Variant,
#[display(fmt = "array")]
#[display("array")]
Array,
#[display(fmt = "bitsequence")]
#[display("bitsequence")]
Bitsequence,
}

Expand Down

0 comments on commit 92685e8

Please sign in to comment.