Skip to content

Commit 2143b3c

Browse files
committed
Fix new toolchain clippy warning about is_multiple_of
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
1 parent e063a4b commit 2143b3c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/hyperlight_common/src/version_note.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ impl<const NAME_SZ: usize, const DESC_SZ: usize> ElfNote<NAME_SZ, DESC_SZ> {
103103

104104
// desc must start at an 8-byte aligned offset from the note start.
105105
assert!(
106-
core::mem::offset_of!(Self, desc) % 8 == 0,
106+
core::mem::offset_of!(Self, desc).is_multiple_of(8),
107107
"desc is not 8-byte aligned"
108108
);
109109

110110
// Total note size must be a multiple of 8 for next-entry alignment.
111111
assert!(
112-
size_of::<Self>() % 8 == 0,
112+
size_of::<Self>().is_multiple_of(8),
113113
"total note size is not 8-byte aligned"
114114
);
115115

src/hyperlight_host/src/sandbox/file_mapping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ pub(crate) fn prepare_file_cow(
282282

283283
// Validate alignment eagerly to fail fast before allocating OS resources.
284284
let page_size = page_size::get();
285-
if guest_base as usize % page_size != 0 {
285+
if !(guest_base as usize).is_multiple_of(page_size) {
286286
log_then_return!(
287287
"map_file_cow: guest_base {:#x} is not page-aligned (page size: {:#x})",
288288
guest_base,

0 commit comments

Comments
 (0)