Skip to content

Commit

Permalink
Enable hex's alloc feature (#60)
Browse files Browse the repository at this point in the history
* Add `alloc` feature

* Remove redundant slicing

* Remove needless question mark
  • Loading branch information
alannotnerd authored May 8, 2021
1 parent 1e12efb commit c0db1bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ std = [
"fixed-hash/std",
"hex/std",
"serde",

"impl-serde",
"impl-codec/std",
"primitive-types/std",
Expand All @@ -22,7 +21,7 @@ std = [
[dependencies]
byteorder = { version = "1.3", default-features = false }
fixed-hash = { version = "0.7", default-features = false }
hex = { version = "0.4", default-features = false }
hex = { version = "0.4", default-features = false, features = ["alloc"] }
serde = { version = "1.0", features = ["derive"], optional = true }

impl-serde = { version = "0.3", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion primitives/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl<'de> serde::de::Visitor<'de> for BytesVisitor {
{
if v.len() >= 2 {
Ok(Bytes(
hex::decode(&v[..]).map_err(|_| serde::de::Error::custom("invalid hex"))?,
hex::decode(v).map_err(|_| serde::de::Error::custom("invalid hex"))?,
))
} else {
Err(serde::de::Error::custom("invalid format"))
Expand Down
12 changes: 6 additions & 6 deletions serialization/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl Deserializable for i32 {
where
T: io::Read,
{
Ok(reader.read_i32::<LittleEndian>()?)
reader.read_i32::<LittleEndian>()
}
}

Expand All @@ -130,7 +130,7 @@ impl Deserializable for i64 {
where
T: io::Read,
{
Ok(reader.read_i64::<LittleEndian>()?)
reader.read_i64::<LittleEndian>()
}
}

Expand All @@ -140,7 +140,7 @@ impl Deserializable for u8 {
where
T: io::Read,
{
Ok(reader.read_u8()?)
reader.read_u8()
}
}

Expand All @@ -150,7 +150,7 @@ impl Deserializable for u16 {
where
T: io::Read,
{
Ok(reader.read_u16::<LittleEndian>()?)
reader.read_u16::<LittleEndian>()
}
}

Expand All @@ -160,7 +160,7 @@ impl Deserializable for u32 {
where
T: io::Read,
{
Ok(reader.read_u32::<LittleEndian>()?)
reader.read_u32::<LittleEndian>()
}
}

Expand All @@ -170,7 +170,7 @@ impl Deserializable for u64 {
where
T: io::Read,
{
Ok(reader.read_u64::<LittleEndian>()?)
reader.read_u64::<LittleEndian>()
}
}

Expand Down

0 comments on commit c0db1bc

Please sign in to comment.