Skip to content

Commit cd4f109

Browse files
Use usize::is_multiple_of instead of %
This fixes a new clippy lint.
1 parent 4488fb3 commit cd4f109

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
66
## [Unreleased]
77

88
- Update `littlefs2` to 0.7
9+
- Update MSRV to 1.87
910

1011
## [v0.4.1](https://github.com/lpc55/lpc55-hal/releases/tag/0.4.1) - 2025-02-28
1112

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ keywords = ["no-std", "cortex-m", "nxp", "lpc", "embedded-hal-impl"]
1111
categories = ["embedded", "no-std"]
1212
authors = ["Nicolas Stalder <n@stalder.io>", "Conor Patrick <conorpp94@gmail.com>", "Hanno Braun <hanno@braun-robotics.com>"]
1313
build = "build.rs"
14+
rust-version = "1.87"
1415

1516
[package.metadata.docs.rs]
1617
targets = []

src/traits/flash.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pub trait Read<ReadSize: ArrayLength> {
3939
// TODO: offer a version without restrictions?
4040
// can round down address, round up buffer length,
4141
// but where to get the buffer from?
42-
assert!(buf.len() % ReadSize::to_usize() == 0);
43-
assert!(address % ReadSize::to_usize() == 0);
42+
assert!(buf.len().is_multiple_of(ReadSize::to_usize()));
43+
assert!(address.is_multiple_of(ReadSize::to_usize()));
4444

4545
for i in (0..buf.len()).step_by(ReadSize::to_usize()) {
4646
self.read_native(
@@ -69,8 +69,8 @@ pub trait WriteErase<EraseSize: ArrayLength, WriteSize: ArrayLength> {
6969

7070
fn write(&mut self, address: usize, data: &[u8]) -> Result {
7171
let write_size = WriteSize::to_usize();
72-
assert!(data.len() % write_size == 0);
73-
assert!(address % write_size == 0);
72+
assert!(data.len().is_multiple_of(write_size));
73+
assert!(address.is_multiple_of(write_size));
7474

7575
// interrupt::free(|cs| {
7676
for i in (0..data.len()).step_by(write_size) {

0 commit comments

Comments
 (0)