Skip to content

Commit

Permalink
refactor: make clippy happy
Browse files Browse the repository at this point in the history
Signed-off-by: Lzzzt <[email protected]>
  • Loading branch information
Lzzzzzt committed Oct 11, 2024
1 parent 84e7d0e commit 63e2ba0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion monoio/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ impl<D> RuntimeBuilder<D> {
/// inner `io_uring` API.
///
/// Refer to the [`io_uring::Builder`] documentation for all the supported methods.

#[cfg(all(target_os = "linux", feature = "iouring"))]
#[must_use]
pub fn uring_builder(mut self, urb: io_uring::Builder) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion monoio/src/driver/uring/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(crate) enum Lifecycle {
Completed(io::Result<u32>, u32),
}

impl<'a> Ref<'a, Lifecycle> {
impl Ref<'_, Lifecycle> {
pub(crate) fn complete(mut self, result: io::Result<u32>, flags: u32) {
let ref_mut = &mut *self;
match ref_mut {
Expand Down
2 changes: 1 addition & 1 deletion monoio/src/io/async_buf_read_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct Guard<'a> {
len: usize,
}

impl<'a> Drop for Guard<'a> {
impl Drop for Guard<'_> {
fn drop(&mut self) {
unsafe {
self.buf.set_len(self.len);
Expand Down
2 changes: 1 addition & 1 deletion monoio/src/net/unix/socket_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl fmt::Debug for SocketAddr {
}
}

impl<'a> fmt::Display for AsciiEscaped<'a> {
impl fmt::Display for AsciiEscaped<'_> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "\"")?;
for byte in self.0.iter().cloned().flat_map(ascii::escape_default) {
Expand Down
2 changes: 1 addition & 1 deletion monoio/src/utils/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl<T: Link> LinkedList<T, T::Target> {
}
}

impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
impl<T, F> Iterator for DrainFilter<'_, T, F>
where
T: Link,
F: FnMut(&mut T::Target) -> bool,
Expand Down
10 changes: 5 additions & 5 deletions monoio/src/utils/slab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ pub(crate) struct Ref<'a, T> {
index: usize,
}

impl<'a, T> Ref<'a, T> {
impl<T> Ref<'_, T> {
#[allow(unused)]
pub(crate) fn remove(self) -> T {
// # Safety
Expand All @@ -153,31 +153,31 @@ impl<'a, T> Ref<'a, T> {
}
}

impl<'a, T> AsRef<T> for Ref<'a, T> {
impl<T> AsRef<T> for Ref<'_, T> {
fn as_ref(&self) -> &T {
// # Safety
// We make sure the index is valid.
unsafe { self.page.get(self.index).unwrap_unchecked() }
}
}

impl<'a, T> AsMut<T> for Ref<'a, T> {
impl<T> AsMut<T> for Ref<'_, T> {
fn as_mut(&mut self) -> &mut T {
// # Safety
// We make sure the index is valid.
unsafe { self.page.get_mut(self.index).unwrap_unchecked() }
}
}

impl<'a, T> Deref for Ref<'a, T> {
impl<T> Deref for Ref<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
self.as_ref()
}
}

impl<'a, T> DerefMut for Ref<'a, T> {
impl<T> DerefMut for Ref<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.as_mut()
}
Expand Down

0 comments on commit 63e2ba0

Please sign in to comment.