From 717ced15217178e19180eba9d7b58a6e285e8778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20CORTIER?= Date: Wed, 6 Sep 2023 16:32:22 -0400 Subject: [PATCH] Refactor advance_date_and_index a bit --- tracing-appender/src/rolling.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tracing-appender/src/rolling.rs b/tracing-appender/src/rolling.rs index 42560667ae..bba1088c4a 100644 --- a/tracing-appender/src/rolling.rs +++ b/tracing-appender/src/rolling.rs @@ -971,19 +971,18 @@ impl Inner { .compare_exchange(current, next_date, Ordering::AcqRel, Ordering::Acquire) .is_ok(); - if next_date_updated { - if let Some(index) = &self.log_filename_index { + match &self.log_filename_index { + Some(index) if next_date_updated => { if current == next_date { index.fetch_add(1, Ordering::SeqCst); } else { index.store(0, Ordering::Release); } } - - true - } else { - false + _ => {} } + + next_date_updated } }