Skip to content

Commit 6236f2b

Browse files
committed
i2c: remove useless lifetimes.
1 parent f43ab6e commit 6236f2b

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

embedded-hal-async/src/i2c.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
4141
/// - `MAK` = master acknowledge
4242
/// - `NMAK` = master no acknowledge
4343
/// - `SP` = stop condition
44-
async fn read<'a>(&'a mut self, address: A, read: &'a mut [u8]) -> Result<(), Self::Error>;
44+
async fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error>;
4545

4646
/// Writes bytes to slave with address `address`
4747
///
@@ -59,7 +59,7 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
5959
/// - `SAK` = slave acknowledge
6060
/// - `Bi` = ith byte of data
6161
/// - `SP` = stop condition
62-
async fn write<'a>(&'a mut self, address: A, write: &'a [u8]) -> Result<(), Self::Error>;
62+
async fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error>;
6363

6464
/// Writes bytes to slave with address `address` and then reads enough bytes to fill `read` *in a
6565
/// single transaction*.
@@ -83,11 +83,11 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
8383
/// - `MAK` = master acknowledge
8484
/// - `NMAK` = master no acknowledge
8585
/// - `SP` = stop condition
86-
async fn write_read<'a>(
87-
&'a mut self,
86+
async fn write_read(
87+
&mut self,
8888
address: A,
89-
write: &'a [u8],
90-
read: &'a mut [u8],
89+
write: &[u8],
90+
read: &mut [u8],
9191
) -> Result<(), Self::Error>;
9292

9393
/// Execute the provided operations on the I2C bus as a single transaction.
@@ -103,35 +103,35 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
103103
/// - `SAD+R/W` = slave address followed by bit 1 to indicate reading or 0 to indicate writing
104104
/// - `SR` = repeated start condition
105105
/// - `SP` = stop condition
106-
async fn transaction<'a, 'b>(
107-
&'a mut self,
106+
async fn transaction(
107+
&mut self,
108108
address: A,
109-
operations: &'a mut [Operation<'b>],
109+
operations: &mut [Operation<'_>],
110110
) -> Result<(), Self::Error>;
111111
}
112112

113113
impl<A: AddressMode, T: I2c<A>> I2c<A> for &mut T {
114-
async fn read<'a>(&'a mut self, address: A, buffer: &'a mut [u8]) -> Result<(), Self::Error> {
114+
async fn read(&mut self, address: A, buffer: &mut [u8]) -> Result<(), Self::Error> {
115115
T::read(self, address, buffer).await
116116
}
117117

118-
async fn write<'a>(&'a mut self, address: A, bytes: &'a [u8]) -> Result<(), Self::Error> {
118+
async fn write(&mut self, address: A, bytes: &[u8]) -> Result<(), Self::Error> {
119119
T::write(self, address, bytes).await
120120
}
121121

122-
async fn write_read<'a>(
123-
&'a mut self,
122+
async fn write_read(
123+
&mut self,
124124
address: A,
125-
bytes: &'a [u8],
126-
buffer: &'a mut [u8],
125+
bytes: &[u8],
126+
buffer: &mut [u8],
127127
) -> Result<(), Self::Error> {
128128
T::write_read(self, address, bytes, buffer).await
129129
}
130130

131-
async fn transaction<'a, 'b>(
132-
&'a mut self,
131+
async fn transaction(
132+
&mut self,
133133
address: A,
134-
operations: &'a mut [Operation<'b>],
134+
operations: &mut [Operation<'_>],
135135
) -> Result<(), Self::Error> {
136136
T::transaction(self, address, operations).await
137137
}

embedded-hal/src/i2c.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
//! // ...
4242
//! # Ok(())
4343
//! }
44-
//! fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
44+
//! fn transaction(&mut self, address: u8, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> {
4545
//! // ...
4646
//! # Ok(())
4747
//! }
@@ -61,7 +61,7 @@
6161
//! // ...
6262
//! # Ok(())
6363
//! }
64-
//! fn transaction<'a>(&mut self, address: u16, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
64+
//! fn transaction(&mut self, address: u16, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> {
6565
//! // ...
6666
//! # Ok(())
6767
//! }
@@ -325,10 +325,10 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
325325
/// - `SAD+R/W` = slave address followed by bit 1 to indicate reading or 0 to indicate writing
326326
/// - `SR` = repeated start condition
327327
/// - `SP` = stop condition
328-
fn transaction<'a>(
328+
fn transaction(
329329
&mut self,
330330
address: A,
331-
operations: &mut [Operation<'a>],
331+
operations: &mut [Operation<'_>],
332332
) -> Result<(), Self::Error>;
333333
}
334334

@@ -350,10 +350,10 @@ impl<A: AddressMode, T: I2c<A>> I2c<A> for &mut T {
350350
T::write_read(self, address, bytes, buffer)
351351
}
352352

353-
fn transaction<'a>(
353+
fn transaction(
354354
&mut self,
355355
address: A,
356-
operations: &mut [Operation<'a>],
356+
operations: &mut [Operation<'_>],
357357
) -> Result<(), Self::Error> {
358358
T::transaction(self, address, operations)
359359
}

0 commit comments

Comments
 (0)