Skip to content

Commit

Permalink
m: Elide lifetimes that can be implicit
Browse files Browse the repository at this point in the history
Pleases clippy.

Signed-off-by: John Nunley <[email protected]>
  • Loading branch information
notgull committed Jan 11, 2025
1 parent 2a13145 commit 4bd9182
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
1 change: 0 additions & 1 deletion doc/src/zmqsource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ use anyhow::Context;
/// messages over the same writeable ZeroMQ socket (usually PUB or PUSH).
/// Messages should be sent over the Calloop MPSC channel sending end. This end
/// can be cloned and used by multiple senders.
pub struct ZeroMQSource<T>
where
T: IntoIterator,
Expand Down
16 changes: 8 additions & 8 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct Async<'l, F: AsFd> {
was_nonblocking: bool,
}

impl<'l, F: AsFd + std::fmt::Debug> std::fmt::Debug for Async<'l, F> {
impl<F: AsFd + std::fmt::Debug> std::fmt::Debug for Async<'_, F> {
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Async").field("fd", &self.fd).finish()
Expand Down Expand Up @@ -146,7 +146,7 @@ pub struct Readable<'s, 'l, F: AsFd> {
io: &'s mut Async<'l, F>,
}

impl<'s, 'l, F: AsFd> std::future::Future for Readable<'s, 'l, F> {
impl<F: AsFd> std::future::Future for Readable<'_, '_, F> {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> TaskPoll<()> {
let io = &mut self.as_mut().io;
Expand All @@ -166,7 +166,7 @@ pub struct Writable<'s, 'l, F: AsFd> {
io: &'s mut Async<'l, F>,
}

impl<'s, 'l, F: AsFd> std::future::Future for Writable<'s, 'l, F> {
impl<F: AsFd> std::future::Future for Writable<'_, '_, F> {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> TaskPoll<()> {
let io = &mut self.as_mut().io;
Expand All @@ -180,7 +180,7 @@ impl<'s, 'l, F: AsFd> std::future::Future for Writable<'s, 'l, F> {
}
}

impl<'l, F: AsFd> Drop for Async<'l, F> {
impl<F: AsFd> Drop for Async<'_, F> {
fn drop(&mut self) {
self.inner.kill(&self.dispatcher);
// restore flags
Expand All @@ -191,15 +191,15 @@ impl<'l, F: AsFd> Drop for Async<'l, F> {
}
}

impl<'l, F: AsFd> Unpin for Async<'l, F> {}
impl<F: AsFd> Unpin for Async<'_, F> {}

trait IoLoopInner {
unsafe fn register(&self, dispatcher: &RefCell<IoDispatcher>) -> crate::Result<()>;
fn reregister(&self, dispatcher: &RefCell<IoDispatcher>) -> crate::Result<()>;
fn kill(&self, dispatcher: &RefCell<IoDispatcher>);
}

impl<'l, Data> IoLoopInner for LoopInner<'l, Data> {
impl<Data> IoLoopInner for LoopInner<'_, Data> {
unsafe fn register(&self, dispatcher: &RefCell<IoDispatcher>) -> crate::Result<()> {
let disp = dispatcher.borrow();
self.poll.borrow_mut().register(
Expand Down Expand Up @@ -306,7 +306,7 @@ impl<Data> EventDispatcher<Data> for RefCell<IoDispatcher> {

#[cfg(feature = "futures-io")]
#[cfg_attr(docsrs, doc(cfg(feature = "futures-io")))]
impl<'l, F: AsFd + std::io::Read> AsyncRead for Async<'l, F> {
impl<F: AsFd + std::io::Read> AsyncRead for Async<'_, F> {
fn poll_read(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down Expand Up @@ -336,7 +336,7 @@ impl<'l, F: AsFd + std::io::Read> AsyncRead for Async<'l, F> {

#[cfg(feature = "futures-io")]
#[cfg_attr(docsrs, doc(cfg(feature = "futures-io")))]
impl<'l, F: AsFd + std::io::Write> AsyncWrite for Async<'l, F> {
impl<F: AsFd + std::io::Write> AsyncWrite for Async<'_, F> {
fn poll_write(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down
12 changes: 6 additions & 6 deletions src/loop_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ pub struct LoopHandle<'l, Data> {
inner: Rc<LoopInner<'l, Data>>,
}

impl<'l, Data> std::fmt::Debug for LoopHandle<'l, Data> {
impl<Data> std::fmt::Debug for LoopHandle<'_, Data> {
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("LoopHandle { ... }")
}
}

impl<'l, Data> Clone for LoopHandle<'l, Data> {
impl<Data> Clone for LoopHandle<'_, Data> {
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
fn clone(&self) -> Self {
LoopHandle {
Expand Down Expand Up @@ -302,7 +302,7 @@ pub struct EventLoop<'l, Data> {
synthetic_events: Vec<PollEvent>,
}

impl<'l, Data> std::fmt::Debug for EventLoop<'l, Data> {
impl<Data> std::fmt::Debug for EventLoop<'_, Data> {
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("EventLoop { ... }")
Expand Down Expand Up @@ -661,7 +661,7 @@ impl<'l, Data> EventLoop<'l, Data> {
}

#[cfg(unix)]
impl<'l, Data> AsRawFd for EventLoop<'l, Data> {
impl<Data> AsRawFd for EventLoop<'_, Data> {
/// Get the underlying raw-fd of the poller.
///
/// This could be used to create [`Generic`] source out of the current loop
Expand All @@ -675,7 +675,7 @@ impl<'l, Data> AsRawFd for EventLoop<'l, Data> {
}

#[cfg(unix)]
impl<'l, Data> AsFd for EventLoop<'l, Data> {
impl<Data> AsFd for EventLoop<'_, Data> {
/// Get the underlying fd of the poller.
///
/// This could be used to create [`Generic`] source out of the current loop
Expand Down Expand Up @@ -714,7 +714,7 @@ pub struct EventIterator<'a> {
registration_token: RegistrationToken,
}

impl<'a> Iterator for EventIterator<'a> {
impl Iterator for EventIterator<'_> {
type Item = (Readiness, Token);

fn next(&mut self) -> Option<Self::Item> {
Expand Down
6 changes: 3 additions & 3 deletions src/sources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ where
/// Use `into_source_inner` to get the event source back.
pub struct Dispatcher<'a, S, Data>(Rc<dyn ErasedDispatcher<'a, S, Data> + 'a>);

impl<'a, S, Data> std::fmt::Debug for Dispatcher<'a, S, Data> {
impl<S, Data> std::fmt::Debug for Dispatcher<'_, S, Data> {
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("Dispatcher { ... }")
Expand Down Expand Up @@ -560,14 +560,14 @@ pub struct Idle<'i> {
pub(crate) callback: Rc<RefCell<dyn CancellableIdle + 'i>>,
}

impl<'i> std::fmt::Debug for Idle<'i> {
impl std::fmt::Debug for Idle<'_> {
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("Idle { ... }")
}
}

impl<'i> Idle<'i> {
impl Idle<'_> {
/// Cancel the idle callback if it was not already run
pub fn cancel(self) {
self.callback.borrow_mut().cancel();
Expand Down
4 changes: 2 additions & 2 deletions src/sources/transient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,13 @@ mod tests {
ping: PingSource,
}

impl<'a> Drop for TestSource<'a> {
impl Drop for TestSource<'_> {
fn drop(&mut self) {
self.dropped.store(true, Ordering::Relaxed)
}
}

impl<'a> crate::EventSource for TestSource<'a> {
impl crate::EventSource for TestSource<'_> {
type Event = ();
type Metadata = ();
type Ret = ();
Expand Down

0 comments on commit 4bd9182

Please sign in to comment.