Use of stable lib feature instead of experimental
The is_multiple_of is a new, experimental feature introduced to the Rust standard library, but it is not yet stabilized. It requires the nightly compiler to work. Therefore, replacing it with the equivalent modulo operator (%) from stable release.
This commit is contained in:
parent
4fce8a5004
commit
29437f21e4
1 changed files with 1 additions and 1 deletions
|
|
@ -238,7 +238,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