Skip to content

Commit 3bdbbce

Browse files
committed
Format
1 parent 2be4a7a commit 3bdbbce

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/hex/dehexify.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,7 @@ where
376376

377377
#[inline(always)]
378378
pub(super) fn strip_0x(hex: &[u8]) -> &[u8] {
379-
if hex.len() >= 2 && hex[0] == b'0' && hex[1] == b'x' {
380-
&hex[2..]
381-
} else {
382-
hex
383-
}
379+
if hex.len() >= 2 && hex[0] == b'0' && hex[1] == b'x' { &hex[2..] } else { hex }
384380
}
385381

386382
#[inline(always)]

src/lib.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! However, this crate also offers many other utilities for Array/Bytes/Hex, each with comprehensive documentation and examples. Check them out on [docs.rs](https://docs.rs/array-bytes)!
1414
//!
1515
//! ```rust
16-
//! use array_bytes::{Dehexify, Hexify, Error};
16+
//! use array_bytes::{Dehexify, Error, Hexify};
1717
//! use smallvec::SmallVec;
1818
//!
1919
//! // Hexify.
@@ -27,7 +27,10 @@
2727
//! // `[u8; N]`.
2828
//! assert_eq!(*b"Love Jane Forever".hexify(), String::from("4c6f7665204a616e6520466f7265766572"));
2929
//! // `&[u8; N]`.
30-
//! assert_eq!(b"Love Jane Forever".hexify_upper(), String::from("4C6F7665204A616E6520466F7265766572"));
30+
//! assert_eq!(
31+
//! b"Love Jane Forever".hexify_upper(),
32+
//! String::from("4C6F7665204A616E6520466F7265766572")
33+
//! );
3134
//! // `&[u8]`.
3235
//! assert_eq!(
3336
//! b"Love Jane Forever".as_slice().hexify_prefixed(),
@@ -52,7 +55,10 @@
5255
//! assert_eq!(u128::dehexify("4f5da2"), Ok(5_201_314));
5356
//! assert_eq!(usize::dehexify("4F5DA2"), Ok(5_201_314));
5457
//! // Array.
55-
//! assert_eq!(<[u8; 17]>::dehexify("0x4c6f7665204a616e6520466f7265766572"), Ok(*b"Love Jane Forever"));
58+
//! assert_eq!(
59+
//! <[u8; 17]>::dehexify("0x4c6f7665204a616e6520466f7265766572"),
60+
//! Ok(*b"Love Jane Forever")
61+
//! );
5662
//! // SmallVec.
5763
//! assert_eq!(
5864
//! SmallVec::dehexify("0x4c6f7665204a616e6520466f7265766572").unwrap().into_vec(),

src/serde.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use core::str;
44
use alloc::format;
55
// crates.io
66
#[cfg(test)] use serde::Serialize;
7-
use serde::{de::Error as _, ser::Error as _, Deserialize, Deserializer, Serializer};
7+
use serde::{Deserialize, Deserializer, Serializer, de::Error as _, ser::Error as _};
88
// self
9-
use crate::{prelude::*, Dehexify, Hexify};
9+
use crate::{Dehexify, Hexify, prelude::*};
1010

1111
/// Serialize bytes to string.
1212
///

0 commit comments

Comments
 (0)