Clippy fixes

This commit is contained in:
Dario Nieuwenhuis
2021-10-18 00:55:43 +02:00
parent d81a203ee2
commit a2e7c24e00
20 changed files with 35 additions and 29 deletions

View File

@ -4,8 +4,8 @@ pub trait Delay {
type DelayFuture<'a>: Future<Output = ()> + 'a;
/// Future that completes after now + millis
fn delay_ms<'a>(&'a mut self, millis: u64) -> Self::DelayFuture<'a>;
fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>;
/// Future that completes after now + micros
fn delay_us<'a>(&'a mut self, micros: u64) -> Self::DelayFuture<'a>;
fn delay_us(&mut self, micros: u64) -> Self::DelayFuture<'_>;
}

View File

@ -37,7 +37,7 @@ pub trait Flash {
/// Erases a single page from the flash device.
///
/// address must be a multiple of self.erase_size().
fn erase<'a>(&'a mut self, address: usize) -> Self::ErasePageFuture<'a>;
fn erase(&mut self, address: usize) -> Self::ErasePageFuture<'_>;
/// Returns the total size, in bytes.
/// This is not guaranteed to be a power of 2.

View File

@ -8,7 +8,7 @@ pub trait WaitForHigh {
///
/// If the pin is already high, the future completes immediately.
/// Otherwise, it completes when it becomes high.
fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a>;
fn wait_for_high(&mut self) -> Self::Future<'_>;
}
/// Wait for a pin to become low.
@ -19,7 +19,7 @@ pub trait WaitForLow {
///
/// If the pin is already low, the future completes immediately.
/// Otherwise, it completes when it becomes low.
fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a>;
fn wait_for_low(&mut self) -> Self::Future<'_>;
}
/// Wait for a rising edge (transition from low to high)
@ -27,7 +27,7 @@ pub trait WaitForRisingEdge {
type Future<'a>: Future<Output = ()> + 'a;
/// Wait for a rising edge (transition from low to high)
fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a>;
fn wait_for_rising_edge(&mut self) -> Self::Future<'_>;
}
/// Wait for a falling edge (transition from high to low)
@ -35,7 +35,7 @@ pub trait WaitForFallingEdge {
type Future<'a>: Future<Output = ()> + 'a;
/// Wait for a falling edge (transition from high to low)
fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a>;
fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>;
}
/// Wait for any edge (any transition, high to low or low to high)
@ -43,5 +43,5 @@ pub trait WaitForAnyEdge {
type Future<'a>: Future<Output = ()> + 'a;
/// Wait for any edge (any transition, high to low or low to high)
fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a>;
fn wait_for_any_edge(&mut self) -> Self::Future<'_>;
}

View File

@ -26,7 +26,7 @@ impl<T: Rng> Random<T> {
Self { rng }
}
pub async fn next_u8<'a>(&'a mut self, range: u8) -> Result<u8, T::Error> {
pub async fn next_u8(&mut self, range: u8) -> Result<u8, T::Error> {
// Lemire's method
let t = (-(range as i8) % (range as i8)) as u8;
loop {
@ -42,7 +42,7 @@ impl<T: Rng> Random<T> {
}
}
pub async fn next_u16<'a>(&'a mut self, range: u16) -> Result<u16, T::Error> {
pub async fn next_u16(&mut self, range: u16) -> Result<u16, T::Error> {
// Lemire's method
let t = (-(range as i16) % (range as i16)) as u16;
loop {
@ -58,7 +58,7 @@ impl<T: Rng> Random<T> {
}
}
pub async fn next_u32<'a>(&'a mut self, range: u32) -> Result<u32, T::Error> {
pub async fn next_u32(&mut self, range: u32) -> Result<u32, T::Error> {
// Lemire's method
let t = (-(range as i32) % (range as i32)) as u32;
loop {