From 1b8e0afdab92fe9e669976304b532662a206c94c Mon Sep 17 00:00:00 2001 From: Daniel Faust Date: Wed, 7 Aug 2024 21:59:50 +0200 Subject: [PATCH] Cleanups --- notify-debouncer-full/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/notify-debouncer-full/src/lib.rs b/notify-debouncer-full/src/lib.rs index a6624984..8a6fb72a 100644 --- a/notify-debouncer-full/src/lib.rs +++ b/notify-debouncer-full/src/lib.rs @@ -208,6 +208,7 @@ impl DebounceDataInner { } } + // drain the entire queue, then process the expired events and re-add the rest // TODO: perfect fit for drain_filter https://github.com/rust-lang/rust/issues/59618 for (path, mut queue) in self.queues.drain() { let mut kind_index = HashMap::new(); @@ -246,13 +247,13 @@ impl DebounceDataInner { /// Returns all currently stored errors pub fn errors(&mut self) -> Vec { - let mut v = Vec::new(); - std::mem::swap(&mut v, &mut self.errors); - v + std::mem::take(&mut self.errors) } /// Add an error entry to re-send later on pub fn add_error(&mut self, error: Error) { + log::trace!("raw error: {error:?}"); + self.errors.push(error); }