Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Oct 4, 2024
1 parent fdd4606 commit ac9c4e1
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 105 deletions.
6 changes: 3 additions & 3 deletions src/bt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ where
}
}

impl<'d, M> Drop for BtDriver<'d, M>
impl<M> Drop for BtDriver<'_, M>
where
M: BtMode,
{
Expand All @@ -724,5 +724,5 @@ where
}
}

unsafe impl<'d, M> Send for BtDriver<'d, M> where M: BtMode {}
unsafe impl<'d, M> Sync for BtDriver<'d, M> where M: BtMode {}
unsafe impl<M> Send for BtDriver<'_, M> where M: BtMode {}
unsafe impl<M> Sync for BtDriver<'_, M> where M: BtMode {}
4 changes: 2 additions & 2 deletions src/bt/ble/gap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub struct AdvConfiguration<'a> {
pub manufacturer_data: Option<&'a [u8]>,
}

impl<'a> Default for AdvConfiguration<'a> {
impl Default for AdvConfiguration<'_> {
fn default() -> Self {
Self {
set_scan_rsp: false,
Expand Down Expand Up @@ -231,7 +231,7 @@ impl<'a> From<&'a AdvConfiguration<'a>> for esp_ble_adv_data_t {

pub struct EventRawData<'a>(pub &'a esp_ble_gap_cb_param_t);

impl<'a> Debug for EventRawData<'a> {
impl Debug for EventRawData<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("EventRawData").finish()
}
Expand Down
2 changes: 1 addition & 1 deletion src/bt/ble/gatt/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub type TransferId = u32;

pub struct EventRawData<'a>(pub &'a esp_ble_gatts_cb_param_t);

impl<'a> Debug for EventRawData<'a> {
impl Debug for EventRawData<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("EventRawData").finish()
}
Expand Down
2 changes: 1 addition & 1 deletion src/espnow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl<'a> EspNow<'a> {
}
}

impl<'a> Drop for EspNow<'a> {
impl Drop for EspNow<'_> {
fn drop(&mut self) {
let mut taken = TAKEN.lock();

Expand Down
18 changes: 9 additions & 9 deletions src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ impl<'d, T> EthDriver<'d, T> {
}
}

impl<'d, T> Eth for EthDriver<'d, T> {
impl<T> Eth for EthDriver<'_, T> {
type Error = EspError;

fn start(&mut self) -> Result<(), Self::Error> {
Expand All @@ -1096,17 +1096,17 @@ impl<'d, T> Eth for EthDriver<'d, T> {
}
}

unsafe impl<'d, T> Send for EthDriver<'d, T> {}
unsafe impl<T> Send for EthDriver<'_, T> {}

impl<'d, T> Drop for EthDriver<'d, T> {
impl<T> Drop for EthDriver<'_, T> {
fn drop(&mut self) {
self.clear_all().unwrap();

info!("EthDriver dropped");
}
}

impl<'d, T> RawHandle for EthDriver<'d, T> {
impl<T> RawHandle for EthDriver<'_, T> {
type Handle = esp_eth_handle_t;

fn handle(&self) -> Self::Handle {
Expand Down Expand Up @@ -1261,7 +1261,7 @@ impl<'d, T> EspEth<'d, T> {
}

#[cfg(esp_idf_comp_esp_netif_enabled)]
impl<'d, T> Drop for EspEth<'d, T> {
impl<T> Drop for EspEth<'_, T> {
fn drop(&mut self) {
self.detach_netif().unwrap();

Expand All @@ -1270,10 +1270,10 @@ impl<'d, T> Drop for EspEth<'d, T> {
}

#[cfg(esp_idf_comp_esp_netif_enabled)]
unsafe impl<'d, T> Send for EspEth<'d, T> {}
unsafe impl<T> Send for EspEth<'_, T> {}

#[cfg(esp_idf_comp_esp_netif_enabled)]
impl<'d, T> RawHandle for EspEth<'d, T> {
impl<T> RawHandle for EspEth<'_, T> {
type Handle = *mut esp_eth_netif_glue_t;

fn handle(&self) -> Self::Handle {
Expand All @@ -1282,7 +1282,7 @@ impl<'d, T> RawHandle for EspEth<'d, T> {
}

#[cfg(esp_idf_comp_esp_netif_enabled)]
impl<'d, T> Eth for EspEth<'d, T> {
impl<T> Eth for EspEth<'_, T> {
type Error = EspError;

fn start(&mut self) -> Result<(), Self::Error> {
Expand All @@ -1303,7 +1303,7 @@ impl<'d, T> Eth for EspEth<'d, T> {
}

#[cfg(esp_idf_comp_esp_netif_enabled)]
impl<'d, T> NetifStatus for EspEth<'d, T> {
impl<T> NetifStatus for EspEth<'_, T> {
fn is_up(&self) -> Result<bool, EspError> {
EspEth::is_up(self)
}
Expand Down
18 changes: 9 additions & 9 deletions src/eventloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct BackgroundLoopConfiguration<'a> {
pub task_pin_to_core: Core,
}

impl<'a> Default for BackgroundLoopConfiguration<'a> {
impl Default for BackgroundLoopConfiguration<'_> {
fn default() -> Self {
Self {
queue_size: 64,
Expand Down Expand Up @@ -217,13 +217,13 @@ impl<'a> EspEventPostData<'a> {
}
}

unsafe impl<'a> EspEventSource for EspEventPostData<'a> {
unsafe impl EspEventSource for EspEventPostData<'_> {
fn source() -> Option<&'static ffi::CStr> {
None
}
}

impl<'a> EspEventSerializer for EspEventPostData<'a> {
impl EspEventSerializer for EspEventPostData<'_> {
type Data<'d> = EspEventPostData<'d>;

fn serialize<F, R>(data: &Self::Data<'_>, f: F) -> R
Expand Down Expand Up @@ -268,13 +268,13 @@ impl<'a> EspEvent<'a> {
}
}

unsafe impl<'a> EspEventSource for EspEvent<'a> {
unsafe impl EspEventSource for EspEvent<'_> {
fn source() -> Option<&'static ffi::CStr> {
None
}
}

impl<'a> EspEventDeserializer for EspEvent<'a> {
impl EspEventDeserializer for EspEvent<'_> {
type Data<'d> = EspEvent<'d>;

fn deserialize<'d>(data: &EspEvent<'d>) -> Self::Data<'d> {
Expand Down Expand Up @@ -343,7 +343,7 @@ where
_callback: Box<Box<dyn FnMut(EspEvent) + Send + 'a>>,
}

impl<'a, T> EspSubscription<'a, T>
impl<T> EspSubscription<'_, T>
where
T: EspEventLoopType,
{
Expand All @@ -369,9 +369,9 @@ where
}
}

unsafe impl<'a, T> Send for EspSubscription<'a, T> where T: EspEventLoopType {}
unsafe impl<T> Send for EspSubscription<'_, T> where T: EspEventLoopType {}

impl<'a, T> Drop for EspSubscription<'a, T>
impl<T> Drop for EspSubscription<'_, T>
where
T: EspEventLoopType,
{
Expand Down Expand Up @@ -404,7 +404,7 @@ where
}
}

impl<'a, T> RawHandle for EspSubscription<'a, User<T>>
impl<T> RawHandle for EspSubscription<'_, User<T>>
where
T: EspEventLoopType,
{
Expand Down
4 changes: 2 additions & 2 deletions src/fs/fatfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub struct MountedFatfs<'a, T> {
fatfs: Box<FATFS>,
}

impl<'a, T> MountedFatfs<'a, T> {
impl<T> MountedFatfs<'_, T> {
/// Get the underlying FATFS instance.
pub fn fatfs(&self) -> &FATFS {
&self.fatfs
Expand All @@ -89,7 +89,7 @@ impl<'a, T> MountedFatfs<'a, T> {
// TODO: Add safe methods to interact with the filesystem
}

impl<'a, T> Drop for MountedFatfs<'a, T> {
impl<T> Drop for MountedFatfs<'_, T> {
fn drop(&mut self) {
let drive_path = self.fs.drive_path();

Expand Down
28 changes: 14 additions & 14 deletions src/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,13 @@ impl<'a> EspHttpServer<'a> {
}
}

impl<'a> Drop for EspHttpServer<'a> {
impl Drop for EspHttpServer<'_> {
fn drop(&mut self) {
self.stop().expect("Unable to stop the server cleanly");
}
}

impl<'a> RawHandle for EspHttpServer<'a> {
impl RawHandle for EspHttpServer<'_> {
type Handle = httpd_handle_t;

fn handle(&self) -> Self::Handle {
Expand Down Expand Up @@ -740,7 +740,7 @@ impl<H, N> NonstaticChain<H, N> {
}
}

unsafe impl<'a> EspHttpTraversableChainNonstatic<'a> for ChainRoot {}
unsafe impl EspHttpTraversableChainNonstatic<'_> for ChainRoot {}

impl<'a, H, N> EspHttpTraversableChain<'a> for NonstaticChain<H, N>
where
Expand All @@ -767,7 +767,7 @@ where

pub struct EspHttpRawConnection<'a>(&'a mut httpd_req_t);

impl<'a> EspHttpRawConnection<'a> {
impl EspHttpRawConnection<'_> {
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize, EspError> {
if !buf.is_empty() {
let fd = unsafe { httpd_req_to_sockfd(self.0) };
Expand Down Expand Up @@ -801,25 +801,25 @@ impl<'a> EspHttpRawConnection<'a> {
}
}

impl<'a> RawHandle for EspHttpRawConnection<'a> {
impl RawHandle for EspHttpRawConnection<'_> {
type Handle = *mut httpd_req_t;

fn handle(&self) -> Self::Handle {
self.0 as *const _ as *mut _
}
}

impl<'a> ErrorType for EspHttpRawConnection<'a> {
impl ErrorType for EspHttpRawConnection<'_> {
type Error = EspIOError;
}

impl<'a> Read for EspHttpRawConnection<'a> {
impl Read for EspHttpRawConnection<'_> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
EspHttpRawConnection::read(self, buf).map_err(EspIOError)
}
}

impl<'a> Write for EspHttpRawConnection<'a> {
impl Write for EspHttpRawConnection<'_> {
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
EspHttpRawConnection::write(self, buf).map_err(EspIOError)
}
Expand Down Expand Up @@ -1130,15 +1130,15 @@ impl<'a> EspHttpConnection<'a> {
}
}

impl<'a> RawHandle for EspHttpConnection<'a> {
impl RawHandle for EspHttpConnection<'_> {
type Handle = *mut httpd_req_t;

fn handle(&self) -> Self::Handle {
self.request.handle()
}
}

impl<'a> Query for EspHttpConnection<'a> {
impl Query for EspHttpConnection<'_> {
fn uri(&self) -> &str {
EspHttpConnection::uri(self)
}
Expand All @@ -1148,23 +1148,23 @@ impl<'a> Query for EspHttpConnection<'a> {
}
}

impl<'a> embedded_svc::http::Headers for EspHttpConnection<'a> {
impl embedded_svc::http::Headers for EspHttpConnection<'_> {
fn header(&self, name: &str) -> Option<&str> {
EspHttpConnection::header(self, name)
}
}

impl<'a> ErrorType for EspHttpConnection<'a> {
impl ErrorType for EspHttpConnection<'_> {
type Error = EspIOError;
}

impl<'a> Read for EspHttpConnection<'a> {
impl Read for EspHttpConnection<'_> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
EspHttpConnection::read(self, buf).map_err(EspIOError)
}
}

impl<'a> Write for EspHttpConnection<'a> {
impl Write for EspHttpConnection<'_> {
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
EspHttpConnection::write(self, buf).map_err(EspIOError)
}
Expand Down
Loading

0 comments on commit ac9c4e1

Please sign in to comment.