diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-10-18 00:55:43 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-10-18 01:05:29 +0200 |
| commit | a2e7c24e0055d13a61345dfce9fbe7fcf4e0d306 (patch) | |
| tree | 2f08fb1e2ed983259ae9eec59f21dbd1e41c5091 /embassy-traits/src | |
| parent | d81a203ee264c8bb77eaae18944d4cace7b1683c (diff) | |
Clippy fixes
Diffstat (limited to 'embassy-traits/src')
| -rw-r--r-- | embassy-traits/src/delay.rs | 4 | ||||
| -rw-r--r-- | embassy-traits/src/flash.rs | 2 | ||||
| -rw-r--r-- | embassy-traits/src/gpio.rs | 10 | ||||
| -rw-r--r-- | embassy-traits/src/rng.rs | 6 |
4 files changed, 11 insertions, 11 deletions
diff --git a/embassy-traits/src/delay.rs b/embassy-traits/src/delay.rs index 31239d319..caa0b100a 100644 --- a/embassy-traits/src/delay.rs +++ b/embassy-traits/src/delay.rs | |||
| @@ -4,8 +4,8 @@ pub trait Delay { | |||
| 4 | type DelayFuture<'a>: Future<Output = ()> + 'a; | 4 | type DelayFuture<'a>: Future<Output = ()> + 'a; |
| 5 | 5 | ||
| 6 | /// Future that completes after now + millis | 6 | /// Future that completes after now + millis |
| 7 | fn delay_ms<'a>(&'a mut self, millis: u64) -> Self::DelayFuture<'a>; | 7 | fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>; |
| 8 | 8 | ||
| 9 | /// Future that completes after now + micros | 9 | /// Future that completes after now + micros |
| 10 | fn delay_us<'a>(&'a mut self, micros: u64) -> Self::DelayFuture<'a>; | 10 | fn delay_us(&mut self, micros: u64) -> Self::DelayFuture<'_>; |
| 11 | } | 11 | } |
diff --git a/embassy-traits/src/flash.rs b/embassy-traits/src/flash.rs index 5e0a4e39f..94e11dbc5 100644 --- a/embassy-traits/src/flash.rs +++ b/embassy-traits/src/flash.rs | |||
| @@ -37,7 +37,7 @@ pub trait Flash { | |||
| 37 | /// Erases a single page from the flash device. | 37 | /// Erases a single page from the flash device. |
| 38 | /// | 38 | /// |
| 39 | /// address must be a multiple of self.erase_size(). | 39 | /// address must be a multiple of self.erase_size(). |
| 40 | fn erase<'a>(&'a mut self, address: usize) -> Self::ErasePageFuture<'a>; | 40 | fn erase(&mut self, address: usize) -> Self::ErasePageFuture<'_>; |
| 41 | 41 | ||
| 42 | /// Returns the total size, in bytes. | 42 | /// Returns the total size, in bytes. |
| 43 | /// This is not guaranteed to be a power of 2. | 43 | /// This is not guaranteed to be a power of 2. |
diff --git a/embassy-traits/src/gpio.rs b/embassy-traits/src/gpio.rs index 9fdb41f56..b8f31fc6c 100644 --- a/embassy-traits/src/gpio.rs +++ b/embassy-traits/src/gpio.rs | |||
| @@ -8,7 +8,7 @@ pub trait WaitForHigh { | |||
| 8 | /// | 8 | /// |
| 9 | /// If the pin is already high, the future completes immediately. | 9 | /// If the pin is already high, the future completes immediately. |
| 10 | /// Otherwise, it completes when it becomes high. | 10 | /// Otherwise, it completes when it becomes high. |
| 11 | fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a>; | 11 | fn wait_for_high(&mut self) -> Self::Future<'_>; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | /// Wait for a pin to become low. | 14 | /// Wait for a pin to become low. |
| @@ -19,7 +19,7 @@ pub trait WaitForLow { | |||
| 19 | /// | 19 | /// |
| 20 | /// If the pin is already low, the future completes immediately. | 20 | /// If the pin is already low, the future completes immediately. |
| 21 | /// Otherwise, it completes when it becomes low. | 21 | /// Otherwise, it completes when it becomes low. |
| 22 | fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a>; | 22 | fn wait_for_low(&mut self) -> Self::Future<'_>; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | /// Wait for a rising edge (transition from low to high) | 25 | /// Wait for a rising edge (transition from low to high) |
| @@ -27,7 +27,7 @@ pub trait WaitForRisingEdge { | |||
| 27 | type Future<'a>: Future<Output = ()> + 'a; | 27 | type Future<'a>: Future<Output = ()> + 'a; |
| 28 | 28 | ||
| 29 | /// Wait for a rising edge (transition from low to high) | 29 | /// Wait for a rising edge (transition from low to high) |
| 30 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::Future<'a>; | 30 | fn wait_for_rising_edge(&mut self) -> Self::Future<'_>; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | /// Wait for a falling edge (transition from high to low) | 33 | /// Wait for a falling edge (transition from high to low) |
| @@ -35,7 +35,7 @@ pub trait WaitForFallingEdge { | |||
| 35 | type Future<'a>: Future<Output = ()> + 'a; | 35 | type Future<'a>: Future<Output = ()> + 'a; |
| 36 | 36 | ||
| 37 | /// Wait for a falling edge (transition from high to low) | 37 | /// Wait for a falling edge (transition from high to low) |
| 38 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::Future<'a>; | 38 | fn wait_for_falling_edge(&'_ mut self) -> Self::Future<'_>; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | /// Wait for any edge (any transition, high to low or low to high) | 41 | /// Wait for any edge (any transition, high to low or low to high) |
| @@ -43,5 +43,5 @@ pub trait WaitForAnyEdge { | |||
| 43 | type Future<'a>: Future<Output = ()> + 'a; | 43 | type Future<'a>: Future<Output = ()> + 'a; |
| 44 | 44 | ||
| 45 | /// Wait for any edge (any transition, high to low or low to high) | 45 | /// Wait for any edge (any transition, high to low or low to high) |
| 46 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a>; | 46 | fn wait_for_any_edge(&mut self) -> Self::Future<'_>; |
| 47 | } | 47 | } |
diff --git a/embassy-traits/src/rng.rs b/embassy-traits/src/rng.rs index 3cc4b2a0b..ac4463ee6 100644 --- a/embassy-traits/src/rng.rs +++ b/embassy-traits/src/rng.rs | |||
| @@ -26,7 +26,7 @@ impl<T: Rng> Random<T> { | |||
| 26 | Self { rng } | 26 | Self { rng } |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | pub async fn next_u8<'a>(&'a mut self, range: u8) -> Result<u8, T::Error> { | 29 | pub async fn next_u8(&mut self, range: u8) -> Result<u8, T::Error> { |
| 30 | // Lemire's method | 30 | // Lemire's method |
| 31 | let t = (-(range as i8) % (range as i8)) as u8; | 31 | let t = (-(range as i8) % (range as i8)) as u8; |
| 32 | loop { | 32 | loop { |
| @@ -42,7 +42,7 @@ impl<T: Rng> Random<T> { | |||
| 42 | } | 42 | } |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | pub async fn next_u16<'a>(&'a mut self, range: u16) -> Result<u16, T::Error> { | 45 | pub async fn next_u16(&mut self, range: u16) -> Result<u16, T::Error> { |
| 46 | // Lemire's method | 46 | // Lemire's method |
| 47 | let t = (-(range as i16) % (range as i16)) as u16; | 47 | let t = (-(range as i16) % (range as i16)) as u16; |
| 48 | loop { | 48 | loop { |
| @@ -58,7 +58,7 @@ impl<T: Rng> Random<T> { | |||
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | pub async fn next_u32<'a>(&'a mut self, range: u32) -> Result<u32, T::Error> { | 61 | pub async fn next_u32(&mut self, range: u32) -> Result<u32, T::Error> { |
| 62 | // Lemire's method | 62 | // Lemire's method |
| 63 | let t = (-(range as i32) % (range as i32)) as u32; | 63 | let t = (-(range as i32) % (range as i32)) as u32; |
| 64 | loop { | 64 | loop { |
