Skip to content

Commit

Permalink
elliptic-curve: fix build failure on nightly (#1589)
Browse files Browse the repository at this point in the history
This tweaks the import of `core::mem::size_of` in order to fix a build
failure due to `unused_qualifications` lint, as the function has now
been moved to Rust prelude.
  • Loading branch information
lucab authored Jun 10, 2024
1 parent f3301d6 commit 51b1977
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions elliptic-curve/src/hash2curve/hash2field/expand_msg/xmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ where
#[cfg(test)]
mod test {
use super::*;
use core::mem;
use core::mem::size_of;
use hex_literal::hex;
use hybrid_array::{
typenum::{U128, U32},
Expand All @@ -177,16 +177,16 @@ mod test {
let msg_len = block + msg.len();
assert_eq!(msg, &bytes[block..msg_len]);

let l = msg_len + mem::size_of::<u16>();
let l = msg_len + size_of::<u16>();
assert_eq!(len_in_bytes.to_be_bytes(), &bytes[msg_len..l]);

let pad = l + mem::size_of::<u8>();
let pad = l + size_of::<u8>();
assert_eq!([0], &bytes[l..pad]);

let dst = pad + usize::from(domain.len());
domain.assert(&bytes[pad..dst]);

let dst_len = dst + mem::size_of::<u8>();
let dst_len = dst + size_of::<u8>();
assert_eq!([domain.len()], &bytes[dst..dst_len]);

assert_eq!(dst_len, bytes.len());
Expand Down
6 changes: 3 additions & 3 deletions elliptic-curve/src/hash2curve/hash2field/expand_msg/xof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ where
#[cfg(test)]
mod test {
use super::*;
use core::mem;
use core::mem::size_of;
use hex_literal::hex;
use hybrid_array::{typenum::U128, Array, ArraySize};
use sha3::Shake128;
Expand All @@ -72,7 +72,7 @@ mod test {
let msg_len = msg.len();
assert_eq!(msg, &bytes[..msg_len]);

let len_in_bytes_len = msg_len + mem::size_of::<u16>();
let len_in_bytes_len = msg_len + size_of::<u16>();
assert_eq!(
len_in_bytes.to_be_bytes(),
&bytes[msg_len..len_in_bytes_len]
Expand All @@ -81,7 +81,7 @@ mod test {
let dst = len_in_bytes_len + usize::from(domain.len());
domain.assert(&bytes[len_in_bytes_len..dst]);

let dst_len = dst + mem::size_of::<u8>();
let dst_len = dst + size_of::<u8>();
assert_eq!([domain.len()], &bytes[dst..dst_len]);

assert_eq!(dst_len, bytes.len());
Expand Down

0 comments on commit 51b1977

Please sign in to comment.