diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00a2e81..80322fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: include: # Test MSRV - - rust: 1.50.0 + - rust: 1.87 TARGET: x86_64-unknown-linux-gnu # Test nightly but don't fail diff --git a/Cargo.toml b/Cargo.toml index c851083..a68bf32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,8 @@ version = "0.3.1" authors = [ "Mathias Koch ", ] -edition = "2018" +edition = "2024" +rust-version = "1.87" description = "A Storage Abstraction Layer for Embedded Systems" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-embedded-community/embedded-storage" diff --git a/src/iter.rs b/src/iter.rs index 7878e6e..c97be93 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -19,7 +19,7 @@ where I: Iterator, { /// Obtain an [`OverlapIterator`] over a subslice of `memory` that overlaps with the region in `self` - fn overlaps(self, memory: &'a [u8], base_address: u32) -> OverlapIterator; + fn overlaps(self, memory: &'a [u8], base_address: u32) -> OverlapIterator<'a, R, I>; } impl<'a, R, I> Iterator for OverlapIterator<'a, R, I> @@ -32,7 +32,7 @@ where fn next(&mut self) -> Option { let mem_start = self.base_address; let mem_end = self.base_address + self.memory.len() as u32; - while let Some(region) = self.regions.next() { + for region in self.regions.by_ref() { if mem_start < region.end() && mem_end >= region.start() { let addr_start = core::cmp::max(mem_start, region.start()); let addr_end = core::cmp::min(mem_end, region.end()); @@ -51,7 +51,7 @@ where R: Region, I: Iterator, { - fn overlaps(self, memory: &'a [u8], base_address: u32) -> OverlapIterator { + fn overlaps(self, memory: &'a [u8], base_address: u32) -> OverlapIterator<'a, R, I> { OverlapIterator { memory, regions: self, diff --git a/src/nor_flash.rs b/src/nor_flash.rs index c241545..1a31974 100644 --- a/src/nor_flash.rs +++ b/src/nor_flash.rs @@ -143,7 +143,7 @@ fn check_slice( if length > flash.capacity() || offset > flash.capacity() - length { return Err(NorFlashErrorKind::OutOfBounds); } - if offset % align != 0 || length % align != 0 { + if !offset.is_multiple_of(align) || !length.is_multiple_of(align) { return Err(NorFlashErrorKind::NotAligned); } Ok(()) @@ -215,7 +215,7 @@ impl Region for Page { } } -/// +/// Read-Modify-Write (RMW) Nor Flash storage structure. pub struct RmwNorFlashStorage<'a, S> { storage: S, merge_buffer: &'a mut [u8], @@ -290,7 +290,7 @@ where } } -/// +/// Read-Modify-Write (RMW) Multi-Write Nor Flash storage structure. pub struct RmwMultiwriteNorFlashStorage<'a, S> { storage: S, merge_buffer: &'a mut [u8],