From 2bbd1ddb8a0e36e91a2b328024f313b780b1b851 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Thu, 16 Dec 2021 11:37:53 +0100 Subject: Remove unneeded rustfmt::skip --- embassy-nrf/src/gpio.rs | 36 ++++++++++++++++++++++++------------ embassy-nrf/src/qspi.rs | 18 ++++++++++++------ embassy-nrf/src/rng.rs | 6 ++++-- embassy-nrf/src/spim.rs | 18 ++++++++++++------ embassy-nrf/src/twim.rs | 18 ++++++++++++------ embassy-nrf/src/uarte.rs | 42 ++++++++++++++++++++++++++++-------------- 6 files changed, 92 insertions(+), 46 deletions(-) (limited to 'embassy-nrf/src') diff --git a/embassy-nrf/src/gpio.rs b/embassy-nrf/src/gpio.rs index 190d8470f..cb06f0971 100644 --- a/embassy-nrf/src/gpio.rs +++ b/embassy-nrf/src/gpio.rs @@ -75,8 +75,10 @@ impl<'d, T: Pin> InputPin for Input<'d, T> { #[cfg(feature = "gpiote")] impl<'d, T: Pin> embassy::traits::gpio::WaitForHigh for Input<'d, T> { - #[rustfmt::skip] - type Future<'a> where Self: 'a = impl Future + Unpin + 'a; + type Future<'a> + where + Self: 'a, + = impl Future + Unpin + 'a; fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a> { self.pin.conf().modify(|_, w| w.sense().high()); @@ -90,8 +92,10 @@ impl<'d, T: Pin> embassy::traits::gpio::WaitForHigh for Input<'d, T> { #[cfg(feature = "gpiote")] impl<'d, T: Pin> embassy::traits::gpio::WaitForLow for Input<'d, T> { - #[rustfmt::skip] - type Future<'a> where Self: 'a = impl Future + Unpin + 'a; + type Future<'a> + where + Self: 'a, + = impl Future + Unpin + 'a; fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a> { self.pin.conf().modify(|_, w| w.sense().low()); @@ -105,8 +109,10 @@ impl<'d, T: Pin> embassy::traits::gpio::WaitForLow for Input<'d, T> { #[cfg(feature = "gpiote")] impl<'d, T: Pin> embassy::traits::gpio::WaitForAnyEdge for Input<'d, T> { - #[rustfmt::skip] - type Future<'a> where Self: 'a = impl Future + Unpin + 'a; + type Future<'a> + where + Self: 'a, + = impl Future + Unpin + 'a; fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { if self.is_high().ok().unwrap() { @@ -328,8 +334,10 @@ impl<'d, T: Pin> StatefulOutputPin for FlexPin<'d, T> { #[cfg(feature = "gpiote")] impl<'d, T: Pin> embassy::traits::gpio::WaitForHigh for FlexPin<'d, T> { - #[rustfmt::skip] - type Future<'a> where Self: 'a = impl Future + Unpin + 'a; + type Future<'a> + where + Self: 'a, + = impl Future + Unpin + 'a; fn wait_for_high<'a>(&'a mut self) -> Self::Future<'a> { self.pin.conf().modify(|_, w| w.sense().high()); @@ -343,8 +351,10 @@ impl<'d, T: Pin> embassy::traits::gpio::WaitForHigh for FlexPin<'d, T> { #[cfg(feature = "gpiote")] impl<'d, T: Pin> embassy::traits::gpio::WaitForLow for FlexPin<'d, T> { - #[rustfmt::skip] - type Future<'a> where Self: 'a = impl Future + Unpin + 'a; + type Future<'a> + where + Self: 'a, + = impl Future + Unpin + 'a; fn wait_for_low<'a>(&'a mut self) -> Self::Future<'a> { self.pin.conf().modify(|_, w| w.sense().low()); @@ -358,8 +368,10 @@ impl<'d, T: Pin> embassy::traits::gpio::WaitForLow for FlexPin<'d, T> { #[cfg(feature = "gpiote")] impl<'d, T: Pin> embassy::traits::gpio::WaitForAnyEdge for FlexPin<'d, T> { - #[rustfmt::skip] - type Future<'a> where Self: 'a = impl Future + Unpin + 'a; + type Future<'a> + where + Self: 'a, + = impl Future + Unpin + 'a; fn wait_for_any_edge<'a>(&'a mut self) -> Self::Future<'a> { if self.is_high().ok().unwrap() { diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs index e87094250..56a757c02 100644 --- a/embassy-nrf/src/qspi.rs +++ b/embassy-nrf/src/qspi.rs @@ -286,12 +286,18 @@ impl<'d, T: Instance> Drop for Qspi<'d, T> { } impl<'d, T: Instance> Flash for Qspi<'d, T> { - #[rustfmt::skip] - type ReadFuture<'a> where Self: 'a = impl Future> + 'a; - #[rustfmt::skip] - type WriteFuture<'a> where Self: 'a = impl Future> + 'a; - #[rustfmt::skip] - type ErasePageFuture<'a> where Self: 'a = impl Future> + 'a; + type ReadFuture<'a> + where + Self: 'a, + = impl Future> + 'a; + type WriteFuture<'a> + where + Self: 'a, + = impl Future> + 'a; + type ErasePageFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn read<'a>(&'a mut self, address: usize, data: &'a mut [u8]) -> Self::ReadFuture<'a> { async move { diff --git a/embassy-nrf/src/rng.rs b/embassy-nrf/src/rng.rs index 20d033a12..645f9860e 100644 --- a/embassy-nrf/src/rng.rs +++ b/embassy-nrf/src/rng.rs @@ -157,8 +157,10 @@ impl<'d> Drop for Rng<'d> { impl<'d> traits::rng::Rng for Rng<'d> { type Error = Infallible; - #[rustfmt::skip] // For some reason rustfmt removes the where clause - type RngFuture<'a> where 'd: 'a = impl Future> + 'a; + type RngFuture<'a> + where + 'd: 'a, + = impl Future> + 'a; fn fill_bytes<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a> { async move { diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs index e88fb460c..c72c4c5bc 100644 --- a/embassy-nrf/src/spim.rs +++ b/embassy-nrf/src/spim.rs @@ -182,8 +182,10 @@ impl<'d, T: Instance> Spi for Spim<'d, T> { } impl<'d, T: Instance> Read for Spim<'d, T> { - #[rustfmt::skip] - type ReadFuture<'a> where Self: 'a = impl Future> + 'a; + type ReadFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn read<'a>(&'a mut self, data: &'a mut [u8]) -> Self::ReadFuture<'a> { self.read_write(data, &[]) @@ -191,8 +193,10 @@ impl<'d, T: Instance> Read for Spim<'d, T> { } impl<'d, T: Instance> Write for Spim<'d, T> { - #[rustfmt::skip] - type WriteFuture<'a> where Self: 'a = impl Future> + 'a; + type WriteFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn write<'a>(&'a mut self, data: &'a [u8]) -> Self::WriteFuture<'a> { self.read_write(&mut [], data) @@ -200,8 +204,10 @@ impl<'d, T: Instance> Write for Spim<'d, T> { } impl<'d, T: Instance> FullDuplex for Spim<'d, T> { - #[rustfmt::skip] - type WriteReadFuture<'a> where Self: 'a = impl Future> + 'a; + type WriteReadFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn read_write<'a>(&'a mut self, rx: &'a mut [u8], tx: &'a [u8]) -> Self::WriteReadFuture<'a> { async move { diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs index 8173f66b0..d42b88d3b 100644 --- a/embassy-nrf/src/twim.rs +++ b/embassy-nrf/src/twim.rs @@ -469,12 +469,18 @@ where { type Error = Error; - #[rustfmt::skip] - type WriteFuture<'a> where Self: 'a = impl Future> + 'a; - #[rustfmt::skip] - type ReadFuture<'a> where Self: 'a = impl Future> + 'a; - #[rustfmt::skip] - type WriteReadFuture<'a> where Self: 'a = impl Future> + 'a; + type WriteFuture<'a> + where + Self: 'a, + = impl Future> + 'a; + type ReadFuture<'a> + where + Self: 'a, + = impl Future> + 'a; + type WriteReadFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn read<'a>(&'a mut self, address: u8, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { async move { diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 17417c0e2..777948198 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs @@ -167,8 +167,10 @@ impl<'d, T: Instance> Uarte<'d, T> { } impl<'d, T: Instance> Read for Uarte<'d, T> { - #[rustfmt::skip] - type ReadFuture<'a> where Self: 'a = impl Future> + 'a; + type ReadFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn read<'a>(&'a mut self, rx_buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { self.rx.read(rx_buffer) @@ -176,8 +178,10 @@ impl<'d, T: Instance> Read for Uarte<'d, T> { } impl<'d, T: Instance> Write for Uarte<'d, T> { - #[rustfmt::skip] - type WriteFuture<'a> where Self: 'a = impl Future> + 'a; + type WriteFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn write<'a>(&'a mut self, tx_buffer: &'a [u8]) -> Self::WriteFuture<'a> { self.tx.write(tx_buffer) @@ -193,8 +197,10 @@ impl<'d, T: Instance> UarteTx<'d, T> { } impl<'d, T: Instance> Write for UarteTx<'d, T> { - #[rustfmt::skip] - type WriteFuture<'a> where Self: 'a = impl Future> + 'a; + type WriteFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn write<'a>(&'a mut self, tx_buffer: &'a [u8]) -> Self::WriteFuture<'a> { async move { @@ -274,8 +280,10 @@ impl<'d, T: Instance> UarteRx<'d, T> { } impl<'d, T: Instance> Read for UarteRx<'d, T> { - #[rustfmt::skip] - type ReadFuture<'a> where Self: 'a = impl Future> + 'a; + type ReadFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn read<'a>(&'a mut self, rx_buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { async move { @@ -490,8 +498,10 @@ impl<'d, U: Instance, T: TimerInstance> UarteWithIdle<'d, U, T> { } impl<'d, U: Instance, T: TimerInstance> ReadUntilIdle for UarteWithIdle<'d, U, T> { - #[rustfmt::skip] - type ReadUntilIdleFuture<'a> where Self: 'a = impl Future> + 'a; + type ReadUntilIdleFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn read_until_idle<'a>(&'a mut self, rx_buffer: &'a mut [u8]) -> Self::ReadUntilIdleFuture<'a> { async move { let ptr = rx_buffer.as_ptr(); @@ -550,8 +560,10 @@ impl<'d, U: Instance, T: TimerInstance> ReadUntilIdle for UarteWithIdle<'d, U, T } impl<'d, U: Instance, T: TimerInstance> Read for UarteWithIdle<'d, U, T> { - #[rustfmt::skip] - type ReadFuture<'a> where Self: 'a = impl Future> + 'a; + type ReadFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn read<'a>(&'a mut self, rx_buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { async move { self.ppi_ch1.disable(); @@ -563,8 +575,10 @@ impl<'d, U: Instance, T: TimerInstance> Read for UarteWithIdle<'d, U, T> { } impl<'d, U: Instance, T: TimerInstance> Write for UarteWithIdle<'d, U, T> { - #[rustfmt::skip] - type WriteFuture<'a> where Self: 'a = impl Future> + 'a; + type WriteFuture<'a> + where + Self: 'a, + = impl Future> + 'a; fn write<'a>(&'a mut self, tx_buffer: &'a [u8]) -> Self::WriteFuture<'a> { self.uarte.write(tx_buffer) -- cgit