fix: replace unstable is_multiple_of with modulo operator (fixes #42)
This commit is contained in:
parent
09d3140127
commit
fc033783b5
1 changed files with 1 additions and 1 deletions
|
|
@ -241,7 +241,7 @@ fn hex_encode(data: &[u8]) -> String {
|
||||||
|
|
||||||
/// Hex-decode a hex string to bytes.
|
/// Hex-decode a hex string to bytes.
|
||||||
fn hex_decode(hex: &str) -> Result<Vec<u8>> {
|
fn hex_decode(hex: &str) -> Result<Vec<u8>> {
|
||||||
if !hex.len().is_multiple_of(2) {
|
if hex.len() % 2 != 0 {
|
||||||
anyhow::bail!("Hex string has odd length");
|
anyhow::bail!("Hex string has odd length");
|
||||||
}
|
}
|
||||||
(0..hex.len())
|
(0..hex.len())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue