Use is_multiple_of in hex decoder (clippy)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@ -21,7 +21,7 @@ impl AesGcmCipher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn hex_decode(s: &str) -> anyhow::Result<Vec<u8>> {
|
fn hex_decode(s: &str) -> anyhow::Result<Vec<u8>> {
|
||||||
anyhow::ensure!(s.len() % 2 == 0, "odd hex length");
|
anyhow::ensure!(s.len().is_multiple_of(2), "odd hex length");
|
||||||
(0..s.len())
|
(0..s.len())
|
||||||
.step_by(2)
|
.step_by(2)
|
||||||
.map(|i| Ok(u8::from_str_radix(&s[i..i + 2], 16)?))
|
.map(|i| Ok(u8::from_str_radix(&s[i..i + 2], 16)?))
|
||||||
|
|||||||
Reference in New Issue
Block a user