Skip to content

Commit ea5dc7a

Browse files
authored
Fix clippy::manual-is-multiple-of (#522)
1 parent b9496d8 commit ea5dc7a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/filters/unsafe_tools.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ pub fn fb_vector_to_slice<T>(vector: flatbuffers::Vector<'_, T>) -> &[T] {
1818
// We can't use T with the size more than MIN_ALIGNMENT.
1919
// Since the beginning of flatbuffer data is aligned to that size,
2020
// the alignment of the data must be a divisor of MIN_ALIGNMENT.
21-
assert!(MIN_ALIGNMENT % std::mem::size_of::<T>() == 0);
21+
assert!(MIN_ALIGNMENT.is_multiple_of(std::mem::size_of::<T>()));
2222
}
2323
let _ = static_assert_alignment::<T>;
2424

25-
assert!(bytes.len() % std::mem::size_of::<T>() == 0);
26-
assert!(bytes.as_ptr() as usize % std::mem::align_of::<T>() == 0);
25+
assert!(bytes.len().is_multiple_of(std::mem::size_of::<T>()));
26+
assert!((bytes.as_ptr() as usize).is_multiple_of(std::mem::align_of::<T>()));
2727
unsafe {
2828
std::slice::from_raw_parts(
2929
bytes.as_ptr() as *const T,
@@ -82,7 +82,7 @@ impl VerifiedFlatFilterListMemory {
8282
raw_data: vec,
8383
start,
8484
};
85-
assert!(memory.data().as_ptr() as usize % MIN_ALIGNMENT == 0);
85+
assert!((memory.data().as_ptr() as usize).is_multiple_of(MIN_ALIGNMENT));
8686
memory
8787
}
8888

0 commit comments

Comments
 (0)