Skip to content

Commit

Permalink
Remove the remaning unneeded lifetimes
Browse files Browse the repository at this point in the history
clippy has started complainig about unneeded lifetimes, so remove
them.

Signed-off-by: Sergio Lopez <[email protected]>
  • Loading branch information
slp committed Dec 5, 2024
1 parent 34bc377 commit ce5eac8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/devices/src/virtio/descriptor_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl<'a> Reader<'a> {
}
}

impl<'a> io::Read for Reader<'a> {
impl io::Read for Reader<'_> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.buffer.consume(buf.len(), |bufs| {
let mut rem = buf;
Expand Down Expand Up @@ -448,7 +448,7 @@ impl<'a> Writer<'a> {
}
}

impl<'a> io::Write for Writer<'a> {
impl io::Write for Writer<'_> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.buffer.consume(buf.len(), |bufs| {
let mut rem = buf;
Expand Down
4 changes: 2 additions & 2 deletions src/devices/src/virtio/file_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub trait FileReadWriteVolatile {
}
}

impl<'a, T: FileReadWriteVolatile + ?Sized> FileReadWriteVolatile for &'a mut T {
impl<T: FileReadWriteVolatile + ?Sized> FileReadWriteVolatile for &mut T {
fn read_volatile(&mut self, slice: VolatileSlice) -> Result<usize> {
(**self).read_volatile(slice)
}
Expand Down Expand Up @@ -194,7 +194,7 @@ pub trait FileReadWriteAtVolatile {
}
}

impl<'a, T: FileReadWriteAtVolatile + ?Sized> FileReadWriteAtVolatile for &'a T {
impl<T: FileReadWriteAtVolatile + ?Sized> FileReadWriteAtVolatile for &T {
fn read_at_volatile(&self, slice: VolatileSlice, offset: u64) -> Result<usize> {
(**self).read_at_volatile(slice, offset)
}
Expand Down
4 changes: 2 additions & 2 deletions src/devices/src/virtio/fs/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ pub trait ZeroCopyReader {
}
}

impl<'a, R: ZeroCopyReader> ZeroCopyReader for &'a mut R {
impl<R: ZeroCopyReader> ZeroCopyReader for &mut R {
fn read_to(&mut self, f: &File, count: usize, off: u64) -> io::Result<usize> {
(**self).read_to(f, count, off)
}
Expand Down Expand Up @@ -291,7 +291,7 @@ pub trait ZeroCopyWriter {
}
}

impl<'a, W: ZeroCopyWriter> ZeroCopyWriter for &'a mut W {
impl<W: ZeroCopyWriter> ZeroCopyWriter for &mut W {
fn write_from(&mut self, f: &File, count: usize, off: u64) -> io::Result<usize> {
(**self).write_from(f, count, off)
}
Expand Down
8 changes: 4 additions & 4 deletions src/devices/src/virtio/fs/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@ const DIRENT_PADDING: [u8; 8] = [0; 8];

struct ZCReader<'a>(Reader<'a>);

impl<'a> ZeroCopyReader for ZCReader<'a> {
impl ZeroCopyReader for ZCReader<'_> {
fn read_to(&mut self, f: &File, count: usize, off: u64) -> io::Result<usize> {
self.0.read_to_at(f, count, off)
}
}

impl<'a> io::Read for ZCReader<'a> {
impl io::Read for ZCReader<'_> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)
}
}

struct ZCWriter<'a>(Writer<'a>);

impl<'a> ZeroCopyWriter for ZCWriter<'a> {
impl ZeroCopyWriter for ZCWriter<'_> {
fn write_from(&mut self, f: &File, count: usize, off: u64) -> io::Result<usize> {
self.0.write_from_at(f, count, off)
}
}

impl<'a> io::Write for ZCWriter<'a> {
impl io::Write for ZCWriter<'_> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
}
Expand Down
1 change: 0 additions & 1 deletion src/devices/src/virtio/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ unsafe impl ByteValued for VirtqUsedElem {}

/// An iterator over a single descriptor chain. Not to be confused with AvailIter,
/// which iterates over the descriptor chain heads in a queue.
pub struct DescIter<'a> {
next: Option<DescriptorChain<'a>>,
}
Expand Down

0 comments on commit ce5eac8

Please sign in to comment.