diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2020-12-26 03:48:45 +0100 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2020-12-26 04:06:54 +0100 |
commit | 6dd6401338073cb5cb9122c9de7506b9b51ba112 (patch) | |
tree | 6055b8dd2bff1af57ac8820ff25992c67473102b /nrf-softdevice | |
parent | ed223a5514521465af62ed24c1d5dd82db5ace8b (diff) | |
download | nrf-softdevice-6dd6401338073cb5cb9122c9de7506b9b51ba112.zip |
cargo fix
Diffstat (limited to 'nrf-softdevice')
-rw-r--r-- | nrf-softdevice/src/ble/central.rs | 11 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/gatt_client.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/gatt_traits.rs | 3 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/l2cap.rs | 17 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/mod.rs | 13 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/peripheral.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/ble/types.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/events.rs | 4 | ||||
-rw-r--r-- | nrf-softdevice/src/flash.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/interrupt.rs | 4 | ||||
-rw-r--r-- | nrf-softdevice/src/random.rs | 3 | ||||
-rw-r--r-- | nrf-softdevice/src/softdevice.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/temperature.rs | 1 | ||||
-rw-r--r-- | nrf-softdevice/src/util/drop_bomb.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/util/on_drop.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/util/portal.rs | 2 | ||||
-rw-r--r-- | nrf-softdevice/src/util/signal.rs | 2 |
17 files changed, 32 insertions, 41 deletions
diff --git a/nrf-softdevice/src/ble/central.rs b/nrf-softdevice/src/ble/central.rs index b5ab8d2..768237f 100644 --- a/nrf-softdevice/src/ble/central.rs +++ b/nrf-softdevice/src/ble/central.rs @@ -5,11 +5,10 @@ use core::mem; use core::ptr; -use core::slice; use crate::ble::types::*; -use crate::ble::{Address, Connection, ConnectionState}; -use crate::fmt::{assert, panic, *}; +use crate::ble::{Address, Connection}; +use crate::fmt::{assert, *}; use crate::raw; use crate::util::{get_union_field, OnDrop, Portal}; use crate::{RawError, Softdevice}; @@ -190,7 +189,7 @@ pub(crate) enum ScanPortalMessage { pub(crate) static SCAN_PORTAL: Portal<ScanPortalMessage> = Portal::new(); pub async fn scan<'a, F, R>( - sd: &Softdevice, + _sd: &Softdevice, config: &ScanConfig<'a>, mut f: F, ) -> Result<R, ScanError> @@ -251,7 +250,7 @@ where } } - let d = OnDrop::new(|| { + let _d = OnDrop::new(|| { let ret = unsafe { raw::sd_ble_gap_scan_stop() }; if let Err(e) = RawError::convert(ret) { warn!("sd_ble_gap_scan_stop: {:?}", e); @@ -261,7 +260,7 @@ where info!("Scan started"); let res = SCAN_PORTAL .wait_many(|msg| match msg { - ScanPortalMessage::Timeout(ble_evt) => return Some(Err(ScanError::Timeout)), + ScanPortalMessage::Timeout(_ble_evt) => return Some(Err(ScanError::Timeout)), ScanPortalMessage::AdvReport(ble_evt) => unsafe { let gap_evt = get_union_field(ble_evt, &(*ble_evt).evt.gap_evt); let params = &gap_evt.params.adv_report; diff --git a/nrf-softdevice/src/ble/gatt_client.rs b/nrf-softdevice/src/ble/gatt_client.rs index 369824e..1dab183 100644 --- a/nrf-softdevice/src/ble/gatt_client.rs +++ b/nrf-softdevice/src/ble/gatt_client.rs @@ -156,7 +156,7 @@ pub(crate) async fn discover_service( match v.len() { 0 => Err(DiscoverError::ServiceNotFound), 1 => Ok(v[0]), - n => { + _n => { warn!( "Found {:?} services with the same UUID, using the first one", params.count diff --git a/nrf-softdevice/src/ble/gatt_traits.rs b/nrf-softdevice/src/ble/gatt_traits.rs index cce038c..8eb50a0 100644 --- a/nrf-softdevice/src/ble/gatt_traits.rs +++ b/nrf-softdevice/src/ble/gatt_traits.rs @@ -1,9 +1,8 @@ -use core::convert::TryInto; use core::mem; use core::slice; use heapless::{ArrayLength, Vec}; -use crate::fmt::{panic, *}; +use crate::fmt::panic; pub enum FromGattError { InvalidLength, diff --git a/nrf-softdevice/src/ble/l2cap.rs b/nrf-softdevice/src/ble/l2cap.rs index 44cd39e..23c456d 100644 --- a/nrf-softdevice/src/ble/l2cap.rs +++ b/nrf-softdevice/src/ble/l2cap.rs @@ -1,6 +1,5 @@ //! Link-Layer Control and Adaptation Protocol -use core::convert::TryInto; use core::marker::PhantomData; use core::ptr; use core::ptr::NonNull; @@ -38,7 +37,7 @@ pub(crate) fn on_ch_setup(ble_evt: *const raw::ble_evt_t) { pub(crate) fn on_ch_released(ble_evt: *const raw::ble_evt_t) { trace!("on_ch_released"); - let conn_handle = evt_conn_handle(ble_evt); + let _conn_handle = evt_conn_handle(ble_evt); } pub(crate) fn on_ch_sdu_buf_released(ble_evt: *const raw::ble_evt_t) { @@ -53,7 +52,7 @@ pub(crate) fn on_ch_sdu_buf_released(ble_evt: *const raw::ble_evt_t) { pub(crate) fn on_ch_credit(ble_evt: *const raw::ble_evt_t) { trace!("on_ch_credit"); - let conn_handle = evt_conn_handle(ble_evt); + let _conn_handle = evt_conn_handle(ble_evt); } pub(crate) fn on_ch_rx(ble_evt: *const raw::ble_evt_t) { @@ -79,7 +78,7 @@ pub enum TxError { } impl From<DisconnectedError> for TxError { - fn from(err: DisconnectedError) -> Self { + fn from(_err: DisconnectedError) -> Self { TxError::Disconnected } } @@ -96,7 +95,7 @@ pub enum RxError { } impl From<DisconnectedError> for RxError { - fn from(err: DisconnectedError) -> Self { + fn from(_err: DisconnectedError) -> Self { RxError::Disconnected } } @@ -115,7 +114,7 @@ pub enum SetupError { } impl From<DisconnectedError> for SetupError { - fn from(err: DisconnectedError) -> Self { + fn from(_err: DisconnectedError) -> Self { SetupError::Disconnected } } @@ -154,7 +153,7 @@ static IS_INIT: AtomicBool = AtomicBool::new(false); static mut PACKET_FREE: Option<unsafe fn(NonNull<u8>)> = None; impl<P: Packet> L2cap<P> { - pub fn init(sd: &Softdevice) -> Self { + pub fn init(_sd: &Softdevice) -> Self { if IS_INIT.compare_and_swap(false, true, Ordering::AcqRel) { panic!("L2cap::init() called multiple times.") } @@ -204,7 +203,7 @@ impl<P: Packet> L2cap<P> { PortalMessage::Disconnected => Err(SetupError::Disconnected), PortalMessage::SetupDone(ble_evt) => unsafe { let l2cap_evt = get_union_field(ble_evt, &(*ble_evt).evt.l2cap_evt); - let evt = &l2cap_evt.params.ch_setup; + let _evt = &l2cap_evt.params.ch_setup; // default is 1 if config.credits != 1 { @@ -230,7 +229,7 @@ impl<P: Packet> L2cap<P> { }, PortalMessage::SetupRefused(ble_evt) => unsafe { let l2cap_evt = get_union_field(ble_evt, &(*ble_evt).evt.l2cap_evt); - let evt = &l2cap_evt.params.ch_setup_refused; + let _evt = &l2cap_evt.params.ch_setup_refused; Err(SetupError::Refused) }, _ => unreachable!(), diff --git a/nrf-softdevice/src/ble/mod.rs b/nrf-softdevice/src/ble/mod.rs index df1a2b3..e3eabd1 100644 --- a/nrf-softdevice/src/ble/mod.rs +++ b/nrf-softdevice/src/ble/mod.rs @@ -1,13 +1,14 @@ //! Bluetooth Low Energy mod connection; -pub use connection::*; -mod types; -pub use types::*; mod events; -pub use events::*; mod gatt_traits; +mod types; + +pub use connection::*; +pub(crate) use events::*; pub use gatt_traits::*; +pub use types::*; #[cfg(feature = "ble-central")] pub mod central; @@ -29,7 +30,7 @@ use core::mem; use crate::fmt::*; use crate::{raw, RawError, Softdevice}; -pub fn get_address(sd: &Softdevice) -> Address { +pub fn get_address(_sd: &Softdevice) -> Address { unsafe { let mut addr: raw::ble_gap_addr_t = mem::zeroed(); let ret = raw::sd_ble_gap_addr_get(&mut addr); @@ -38,7 +39,7 @@ pub fn get_address(sd: &Softdevice) -> Address { } } -pub fn set_address(sd: &Softdevice, addr: &Address) { +pub fn set_address(_sd: &Softdevice, addr: &Address) { unsafe { let addr = addr.into_raw(); let ret = raw::sd_ble_gap_addr_set(&addr); diff --git a/nrf-softdevice/src/ble/peripheral.rs b/nrf-softdevice/src/ble/peripheral.rs index db26aea..6679eca 100644 --- a/nrf-softdevice/src/ble/peripheral.rs +++ b/nrf-softdevice/src/ble/peripheral.rs @@ -133,7 +133,7 @@ pub(crate) static ADV_PORTAL: Portal<Result<Connection, AdvertiseError>> = Porta // Begins an ATT MTU exchange procedure, followed by a data length update request as necessary. pub async fn advertise( - sd: &Softdevice, + _sd: &Softdevice, adv: ConnectableAdvertisement<'_>, config: &Config, ) -> Result<Connection, AdvertiseError> { diff --git a/nrf-softdevice/src/ble/types.rs b/nrf-softdevice/src/ble/types.rs index f64fe9f..3d56823 100644 --- a/nrf-softdevice/src/ble/types.rs +++ b/nrf-softdevice/src/ble/types.rs @@ -1,6 +1,6 @@ use core::mem; -use crate::fmt::{panic, *}; +use crate::fmt::panic; use crate::raw; use crate::RawError; diff --git a/nrf-softdevice/src/events.rs b/nrf-softdevice/src/events.rs index 3372ac5..7ee729f 100644 --- a/nrf-softdevice/src/events.rs +++ b/nrf-softdevice/src/events.rs @@ -2,10 +2,10 @@ use core::convert::TryFrom; use core::mem::MaybeUninit; use num_enum::{IntoPrimitive, TryFromPrimitive}; -use crate::fmt::{panic, unreachable, *}; +use crate::fmt::{panic, *}; use crate::util::Signal; +use crate::RawError; use crate::{interrupt, raw}; -use crate::{RawError, Softdevice}; static SWI2_SIGNAL: Signal<()> = Signal::new(); diff --git a/nrf-softdevice/src/flash.rs b/nrf-softdevice/src/flash.rs index 3c7f70b..4f9f8af 100644 --- a/nrf-softdevice/src/flash.rs +++ b/nrf-softdevice/src/flash.rs @@ -24,7 +24,7 @@ impl Flash { /// # Panics /// /// Panics if called more than once. - pub fn take(sd: &Softdevice) -> Flash { + pub fn take(_sd: &Softdevice) -> Flash { if FLASH_TAKEN.compare_and_swap(false, true, Ordering::AcqRel) { panic!("nrf_softdevice::Softdevice::take_flash() called multiple times.") } diff --git a/nrf-softdevice/src/interrupt.rs b/nrf-softdevice/src/interrupt.rs index 9537ac7..70568df 100644 --- a/nrf-softdevice/src/interrupt.rs +++ b/nrf-softdevice/src/interrupt.rs @@ -6,7 +6,7 @@ //! //! You must NOT use any other crate to manage interrupts, such as `cortex-m`'s `NVIC`. -use crate::fmt::{assert, unreachable, *}; +use crate::fmt::{assert, unreachable}; use crate::pac::{NVIC, NVIC_PRIO_BITS}; use core::sync::atomic::{compiler_fence, AtomicBool, Ordering}; @@ -118,7 +118,7 @@ where F: FnOnce(&CriticalSection) -> R, { unsafe { - let nvic = &*NVIC::ptr(); + let _nvic = &*NVIC::ptr(); let token = disable_all(); let r = f(&CriticalSection::new()); diff --git a/nrf-softdevice/src/random.rs b/nrf-softdevice/src/random.rs index 1761fdc..d37e0de 100644 --- a/nrf-softdevice/src/random.rs +++ b/nrf-softdevice/src/random.rs @@ -1,6 +1,3 @@ -use fixed::types::I30F2; - -use crate::fmt::*; use crate::{raw, RawError, Softdevice}; #[cfg_attr(feature = "defmt", derive(defmt::Format))] diff --git a/nrf-softdevice/src/softdevice.rs b/nrf-softdevice/src/softdevice.rs index 0fb5c82..52ab002 100644 --- a/nrf-softdevice/src/softdevice.rs +++ b/nrf-softdevice/src/softdevice.rs @@ -3,7 +3,6 @@ use core::ptr; use core::sync::atomic::{AtomicBool, Ordering}; use embassy::util::Forever; -use crate::ble; use crate::fmt::{panic, *}; use crate::interrupt; use crate::pac; diff --git a/nrf-softdevice/src/temperature.rs b/nrf-softdevice/src/temperature.rs index 1a84a80..9efcaf2 100644 --- a/nrf-softdevice/src/temperature.rs +++ b/nrf-softdevice/src/temperature.rs @@ -1,6 +1,5 @@ use fixed::types::I30F2; -use crate::fmt::*; use crate::{raw, RawError, Softdevice}; #[cfg_attr(feature = "defmt", derive(defmt::Format))] diff --git a/nrf-softdevice/src/util/drop_bomb.rs b/nrf-softdevice/src/util/drop_bomb.rs index a0e6f33..e5c44c2 100644 --- a/nrf-softdevice/src/util/drop_bomb.rs +++ b/nrf-softdevice/src/util/drop_bomb.rs @@ -1,6 +1,6 @@ use core::mem; -use crate::fmt::{panic, *}; +use crate::fmt::panic; pub struct DropBomb { _private: (), diff --git a/nrf-softdevice/src/util/on_drop.rs b/nrf-softdevice/src/util/on_drop.rs index fe2d294..6a34609 100644 --- a/nrf-softdevice/src/util/on_drop.rs +++ b/nrf-softdevice/src/util/on_drop.rs @@ -1,5 +1,3 @@ -use core::mem; - pub struct OnDrop<F: FnOnce()> { f: Option<F>, } diff --git a/nrf-softdevice/src/util/portal.rs b/nrf-softdevice/src/util/portal.rs index baadfc1..50e4e8b 100644 --- a/nrf-softdevice/src/util/portal.rs +++ b/nrf-softdevice/src/util/portal.rs @@ -3,7 +3,7 @@ use core::future::Future; use core::mem; use core::mem::MaybeUninit; -use crate::fmt::{assert, panic, unreachable, *}; +use crate::fmt::{assert, panic, unreachable}; use crate::util::{OnDrop, Signal}; /// Utility to call a closure across tasks. diff --git a/nrf-softdevice/src/util/signal.rs b/nrf-softdevice/src/util/signal.rs index 687c3b0..d0eb942 100644 --- a/nrf-softdevice/src/util/signal.rs +++ b/nrf-softdevice/src/util/signal.rs @@ -4,7 +4,7 @@ use core::mem; use core::pin::Pin; use core::task::{Context, Poll, Waker}; -use crate::fmt::{panic, unreachable, *}; +use crate::fmt::{panic, unreachable}; pub struct Signal<T> { state: UnsafeCell<State<T>>, |