Skip to content

Commit c4f67c1

Browse files
committed
Fix clippy manual_is_multiple_of errors
Replace manual modulo checks with .is_multiple_of() method: - Line 250: p % N == 0 -> p.is_multiple_of(N) - Line 271: address % align == 0 -> address.is_multiple_of(align)
1 parent 1a3638d commit c4f67c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mappings/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ mod enabled {
247247
/// Increases `p` as little as possible (including possibly 0)
248248
/// such that it becomes a multiple of `N`.
249249
pub const fn align_up<const N: usize>(p: usize) -> usize {
250-
if p % N == 0 {
250+
if p.is_multiple_of(N) {
251251
p
252252
} else {
253253
p + (N - (p % N))
@@ -268,7 +268,7 @@ mod enabled {
268268
let align = std::mem::align_of::<T>();
269269

270270
assert!(!ptr.is_null());
271-
assert!(address % align == 0, "unaligned pointer");
271+
assert!(address.is_multiple_of(align), "unaligned pointer");
272272
}
273273

274274
fn current_exe_from_dladdr() -> Result<PathBuf, anyhow::Error> {

0 commit comments

Comments
 (0)