From 331a84627abdd862c17f2b032168e6e1afaf5580 Mon Sep 17 00:00:00 2001 From: xenofem Date: Tue, 10 May 2022 10:13:47 -0400 Subject: [PATCH] clean up LiveFileReader using ready! macro --- src/download.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/download.rs b/src/download.rs index 196545a..6a4aeb2 100644 --- a/src/download.rs +++ b/src/download.rs @@ -288,19 +288,12 @@ where if offset >= *this.available_file_size { trace!("waiting for inotify events"); file.get_or_insert(inner_file); - match this.events.poll_next(cx) { - Poll::Pending => { - return Poll::Pending; - } - Poll::Ready(Some(_)) => { - return self.poll_next(cx); - } - _ => { - return Poll::Ready(Some(Err(ErrorInternalServerError( - "inotify stream empty", - )))); - } + if ready!(this.events.poll_next(cx)).is_none() { + return Poll::Ready(Some(Err(ErrorInternalServerError( + "inotify stream empty", + )))); } + return self.poll_next(cx); } }