Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Jul 28, 2023
1 parent 52731c9 commit 318f25f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<'a> FlashWriter<'a> {
}

fn valid_length(&self, offset: u32, length: usize) -> Result<()> {
if offset + length as u32 > self.flash_sz.kbytes() as u32 {
if offset + length as u32 > self.flash_sz.kbytes() {
Err(Error::LengthTooLong)
} else if length & 0x1 != 0 {
Err(Error::LengthNotMultiple2)
Expand Down Expand Up @@ -178,7 +178,7 @@ impl<'a> FlashWriter<'a> {
let size = self.sector_sz.kbytes() as u32;
let start = start_offset & !(size - 1);
for idx in (start..start + size).step_by(2) {
let write_address = (FLASH_START + idx as u32) as *const u16;
let write_address = (FLASH_START + idx) as *const u16;
let verify: u16 = unsafe { core::ptr::read_volatile(write_address) };
if verify != 0xFFFF {
return Err(Error::VerifyError);
Expand Down Expand Up @@ -209,7 +209,7 @@ impl<'a> FlashWriter<'a> {
pub fn read(&self, offset: u32, length: usize) -> Result<&[u8]> {
self.valid_address(offset)?;

if offset + length as u32 > self.flash_sz.kbytes() as u32 {
if offset + length as u32 > self.flash_sz.kbytes() {
return Err(Error::LengthTooLong);
}

Expand Down
3 changes: 3 additions & 0 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ pub trait GpioExt {
fn split(self) -> Self::Parts;

/// Splits the GPIO block into independent pins and registers without resetting its state.
///
/// # Safety
/// Make sure that all pins modes are set in reset state.
unsafe fn split_without_reset(self) -> Self::Parts;
}

Expand Down

0 comments on commit 318f25f

Please sign in to comment.