From 149ddf2f29bf6e7fd15a45e164fafac936197599 Mon Sep 17 00:00:00 2001 From: Rukai Date: Mon, 17 May 2021 19:48:58 +1000 Subject: [PATCH] Fix warnings --- embassy-extras/src/ring_buffer.rs | 2 +- embassy-nrf-examples/src/bin/blinky.rs | 3 +-- embassy-nrf-examples/src/bin/buffered_uart.rs | 2 +- embassy-nrf-examples/src/bin/executor_fairness_test.rs | 2 +- embassy-nrf-examples/src/bin/gpiote_channel.rs | 2 +- embassy-nrf-examples/src/bin/ppi.rs | 2 +- embassy-nrf-examples/src/bin/pwm.rs | 2 +- embassy-nrf-examples/src/bin/qspi.rs | 2 +- embassy-nrf-examples/src/bin/spim.rs | 3 +-- embassy-nrf-examples/src/bin/timer.rs | 2 +- embassy-nrf-examples/src/bin/uart.rs | 3 +-- embassy-nrf-examples/src/bin/uart_idle.rs | 5 ++--- embassy-nrf/src/gpio.rs | 1 - embassy-nrf/src/pwm.rs | 2 +- embassy-nrf/src/qspi.rs | 3 +-- embassy-nrf/src/spim.rs | 6 +++--- embassy-nrf/src/uarte.rs | 8 ++------ 17 files changed, 20 insertions(+), 30 deletions(-) diff --git a/embassy-extras/src/ring_buffer.rs b/embassy-extras/src/ring_buffer.rs index 0ef66f00..dafdd958 100644 --- a/embassy-extras/src/ring_buffer.rs +++ b/embassy-extras/src/ring_buffer.rs @@ -1,4 +1,4 @@ -use crate::fmt::{assert, *}; +use crate::fmt::assert; pub struct RingBuffer<'a> { buf: &'a mut [u8], diff --git a/embassy-nrf-examples/src/bin/blinky.rs b/embassy-nrf-examples/src/bin/blinky.rs index e6fc854b..8f12cfda 100644 --- a/embassy-nrf-examples/src/bin/blinky.rs +++ b/embassy-nrf-examples/src/bin/blinky.rs @@ -7,7 +7,6 @@ #[path = "../example_common.rs"] mod example_common; -use example_common::*; use defmt::panic; use embassy::executor::Spawner; @@ -17,7 +16,7 @@ use embassy_nrf::Peripherals; use embedded_hal::digital::v2::OutputPin; #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); loop { diff --git a/embassy-nrf-examples/src/bin/buffered_uart.rs b/embassy-nrf-examples/src/bin/buffered_uart.rs index b3a621c6..c800e64f 100644 --- a/embassy-nrf-examples/src/bin/buffered_uart.rs +++ b/embassy-nrf-examples/src/bin/buffered_uart.rs @@ -17,7 +17,7 @@ use example_common::*; use futures::pin_mut; #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { let mut config = uarte::Config::default(); config.parity = uarte::Parity::EXCLUDED; config.baudrate = uarte::Baudrate::BAUD115200; diff --git a/embassy-nrf-examples/src/bin/executor_fairness_test.rs b/embassy-nrf-examples/src/bin/executor_fairness_test.rs index ca9bcc1e..797be433 100644 --- a/embassy-nrf-examples/src/bin/executor_fairness_test.rs +++ b/embassy-nrf-examples/src/bin/executor_fairness_test.rs @@ -40,7 +40,7 @@ async fn run3() { } #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(spawner: Spawner, _p: Peripherals) { unwrap!(spawner.spawn(run1())); unwrap!(spawner.spawn(run2())); unwrap!(spawner.spawn(run3())); diff --git a/embassy-nrf-examples/src/bin/gpiote_channel.rs b/embassy-nrf-examples/src/bin/gpiote_channel.rs index d52ed776..9800aed9 100644 --- a/embassy-nrf-examples/src/bin/gpiote_channel.rs +++ b/embassy-nrf-examples/src/bin/gpiote_channel.rs @@ -16,7 +16,7 @@ use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; use embassy_nrf::{interrupt, Peripherals}; #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { info!("Starting!"); let ch1 = InputChannel::new( diff --git a/embassy-nrf-examples/src/bin/ppi.rs b/embassy-nrf-examples/src/bin/ppi.rs index 47782ed2..717604b9 100644 --- a/embassy-nrf-examples/src/bin/ppi.rs +++ b/embassy-nrf-examples/src/bin/ppi.rs @@ -19,7 +19,7 @@ use embassy_nrf::{interrupt, Peripherals}; use gpiote::{OutputChannel, OutputChannelPolarity}; #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { info!("Starting!"); let button1 = InputChannel::new( diff --git a/embassy-nrf-examples/src/bin/pwm.rs b/embassy-nrf-examples/src/bin/pwm.rs index 6efcf22d..d2874a29 100644 --- a/embassy-nrf-examples/src/bin/pwm.rs +++ b/embassy-nrf-examples/src/bin/pwm.rs @@ -87,7 +87,7 @@ static DUTY: [u16; 1024] = [ ]; #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { let pwm = Pwm::new(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15); pwm.set_prescaler(Prescaler::Div1); info!("pwm initialized!"); diff --git a/embassy-nrf-examples/src/bin/qspi.rs b/embassy-nrf-examples/src/bin/qspi.rs index 3dc027f6..14f21518 100644 --- a/embassy-nrf-examples/src/bin/qspi.rs +++ b/embassy-nrf-examples/src/bin/qspi.rs @@ -23,7 +23,7 @@ const PAGE_SIZE: usize = 4096; struct AlignedBuf([u8; 4096]); #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { let csn = p.P0_17; let sck = p.P0_19; let io0 = p.P0_20; diff --git a/embassy-nrf-examples/src/bin/spim.rs b/embassy-nrf-examples/src/bin/spim.rs index df921fc8..c42cc601 100644 --- a/embassy-nrf-examples/src/bin/spim.rs +++ b/embassy-nrf-examples/src/bin/spim.rs @@ -10,7 +10,6 @@ mod example_common; use defmt::panic; use embassy::executor::Spawner; -use embassy::util::Steal; use embassy_nrf::gpio::{Level, Output, OutputDrive}; use embassy_nrf::Peripherals; use embassy_nrf::{interrupt, spim}; @@ -19,7 +18,7 @@ use embedded_hal::digital::v2::*; use example_common::*; #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { info!("running!"); let mut config = spim::Config::default(); diff --git a/embassy-nrf-examples/src/bin/timer.rs b/embassy-nrf-examples/src/bin/timer.rs index ffbbb784..43f6d76c 100644 --- a/embassy-nrf-examples/src/bin/timer.rs +++ b/embassy-nrf-examples/src/bin/timer.rs @@ -31,7 +31,7 @@ async fn run2() { } #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(spawner: Spawner, _p: Peripherals) { unwrap!(spawner.spawn(run1())); unwrap!(spawner.spawn(run2())); } diff --git a/embassy-nrf-examples/src/bin/uart.rs b/embassy-nrf-examples/src/bin/uart.rs index 9a0e65d3..e65e2fe5 100644 --- a/embassy-nrf-examples/src/bin/uart.rs +++ b/embassy-nrf-examples/src/bin/uart.rs @@ -12,12 +12,11 @@ use example_common::*; use defmt::panic; use embassy::executor::Spawner; use embassy::traits::uart::{Read, Write}; -use embassy::util::Steal; use embassy_nrf::gpio::NoPin; use embassy_nrf::{interrupt, uarte, Peripherals}; #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { let mut config = uarte::Config::default(); config.parity = uarte::Parity::EXCLUDED; config.baudrate = uarte::Baudrate::BAUD115200; diff --git a/embassy-nrf-examples/src/bin/uart_idle.rs b/embassy-nrf-examples/src/bin/uart_idle.rs index a97c6593..dc2c7343 100644 --- a/embassy-nrf-examples/src/bin/uart_idle.rs +++ b/embassy-nrf-examples/src/bin/uart_idle.rs @@ -12,13 +12,12 @@ use example_common::*; use defmt::panic; use embassy::executor::Spawner; -use embassy::traits::uart::{Read, Write}; -use embassy::util::Steal; +use embassy::traits::uart::Write; use embassy_nrf::gpio::NoPin; use embassy_nrf::{interrupt, uarte, Peripherals}; #[embassy::main] -async fn main(spawner: Spawner, p: Peripherals) { +async fn main(_spawner: Spawner, p: Peripherals) { let mut config = uarte::Config::default(); config.parity = uarte::Parity::EXCLUDED; config.baudrate = uarte::Baudrate::BAUD115200; diff --git a/embassy-nrf/src/gpio.rs b/embassy-nrf/src/gpio.rs index fed1ae04..223247d6 100644 --- a/embassy-nrf/src/gpio.rs +++ b/embassy-nrf/src/gpio.rs @@ -11,7 +11,6 @@ use gpio::pin_cnf::DRIVE_A; use crate::pac; use crate::pac::p0 as gpio; -use crate::peripherals; /// A GPIO port with up to 32 pins. #[derive(Debug, Eq, PartialEq)] diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index 34c31e3b..da933cc8 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs @@ -6,7 +6,7 @@ use core::sync::atomic::{compiler_fence, Ordering}; use embassy::util::Unborrow; use embassy_extras::unborrow; -use crate::fmt::{assert, panic, unreachable, *}; +use crate::fmt::{unreachable, *}; use crate::gpio::sealed::Pin as _; use crate::gpio::OptionalPin as GpioOptionalPin; use crate::interrupt::Interrupt; diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs index db6b653e..ea19ccf5 100644 --- a/embassy-nrf/src/qspi.rs +++ b/embassy-nrf/src/qspi.rs @@ -11,8 +11,7 @@ use futures::future::poll_fn; use crate::fmt::{assert, assert_eq, *}; use crate::gpio::Pin as GpioPin; -use crate::interrupt::{self}; -use crate::{pac, peripherals}; +use crate::pac; pub use crate::pac::qspi::ifconfig0::ADDRMODE_A as AddressMode; pub use crate::pac::qspi::ifconfig0::PPSIZE_A as WritePageSize; diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs index 0703836b..e5d07730 100644 --- a/embassy-nrf/src/spim.rs +++ b/embassy-nrf/src/spim.rs @@ -13,8 +13,8 @@ use traits::spi::FullDuplex; use crate::gpio::sealed::Pin as _; use crate::gpio::{OptionalPin, Pin as GpioPin}; -use crate::interrupt::{self, Interrupt}; -use crate::{pac, peripherals, util::slice_in_ram_or}; +use crate::interrupt::Interrupt; +use crate::{pac, util::slice_in_ram_or}; pub use embedded_hal::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}; pub use pac::spim0::frequency::FREQUENCY_A as Frequency; @@ -285,7 +285,7 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Write for Spim<'d, T> { fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { slice_in_ram_or(words, Error::DMABufferNotInDataMemory)?; - let mut recv: &mut [u8] = &mut []; + let recv: &mut [u8] = &mut []; // Conservative compiler fence to prevent optimizations that do not // take in to account actions by DMA. The fence has been placed here, diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 494110be..3ad7a787 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs @@ -16,10 +16,8 @@ use crate::chip::EASY_DMA_SIZE; use crate::fmt::{assert, panic, *}; use crate::gpio::sealed::Pin as _; use crate::gpio::{OptionalPin as GpioOptionalPin, Pin as GpioPin}; -use crate::interrupt; use crate::interrupt::Interrupt; use crate::pac; -use crate::peripherals; use crate::ppi::{AnyConfigurableChannel, ConfigurableChannel, Event, Ppi, Task}; use crate::timer::Instance as TimerInstance; @@ -43,7 +41,6 @@ impl Default for Config { /// Interface to the UARTE peripheral pub struct Uarte<'d, T: Instance> { - peri: T, phantom: PhantomData<&'d mut T>, } @@ -58,7 +55,7 @@ impl<'d, T: Instance> Uarte<'d, T> { /// or [`receive`](Uarte::receive). #[allow(unused_unsafe)] pub unsafe fn new( - uarte: impl Unborrow + 'd, + _uarte: impl Unborrow + 'd, irq: impl Unborrow + 'd, rxd: impl Unborrow + 'd, txd: impl Unborrow + 'd, @@ -66,7 +63,7 @@ impl<'d, T: Instance> Uarte<'d, T> { rts: impl Unborrow + 'd, config: Config, ) -> Self { - unborrow!(uarte, irq, rxd, txd, cts, rts); + unborrow!(irq, rxd, txd, cts, rts); let r = T::regs(); @@ -119,7 +116,6 @@ impl<'d, T: Instance> Uarte<'d, T> { r.enable.write(|w| w.enable().enabled()); Self { - peri: uarte, phantom: PhantomData, } }