Fix a few clippy warnings

This commit is contained in:
Ulf Lilleengen 2022-09-02 08:42:42 +02:00
parent 8b464d2668
commit 3aa0c13ba5

View File

@ -28,6 +28,7 @@ impl Partition {
} }
/// Return the length of the partition /// Return the length of the partition
#[allow(clippy::len_without_is_empty)]
pub const fn len(&self) -> usize { pub const fn len(&self) -> usize {
self.to - self.from self.to - self.from
} }
@ -229,8 +230,7 @@ impl BootLoader {
// Copy contents from partition N to active // Copy contents from partition N to active
let state = self.read_state(p, magic)?; let state = self.read_state(p, magic)?;
match state { if state == State::Swap {
State::Swap => {
// //
// Check if we already swapped. If we're in the swap state, this means we should revert // Check if we already swapped. If we're in the swap state, this means we should revert
// since the app has failed to mark boot as successful // since the app has failed to mark boot as successful
@ -253,8 +253,6 @@ impl BootLoader {
fstate.write(self.state.from as u32, magic)?; fstate.write(self.state.from as u32, magic)?;
} }
} }
_ => {}
}
Ok(state) Ok(state)
} }
@ -1005,7 +1003,7 @@ mod tests {
const ERASE_SIZE: usize = ERASE_SIZE; const ERASE_SIZE: usize = ERASE_SIZE;
type EraseFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a; type EraseFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a;
fn erase<'a>(&'a mut self, from: u32, to: u32) -> Self::EraseFuture<'a> { fn erase(&mut self, from: u32, to: u32) -> Self::EraseFuture<'_> {
async move { async move {
let from = from as usize; let from = from as usize;
let to = to as usize; let to = to as usize;