From ffaee762c9ef94760cc7544f51457cab9ad61ae6 Mon Sep 17 00:00:00 2001 From: KevFan Date: Thu, 12 Oct 2023 14:35:39 +0100 Subject: [PATCH] refactor: use or_default() instead of or_insert_with() Since rust1.73 was released, clippy recommends using or_default() - https://rust-lang.github.io/rust-clippy/master/index.html#/unwrap_or_default --- limitador/src/storage/in_memory.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limitador/src/storage/in_memory.rs b/limitador/src/storage/in_memory.rs index 485a576c..a1b21dc5 100644 --- a/limitador/src/storage/in_memory.rs +++ b/limitador/src/storage/in_memory.rs @@ -40,9 +40,9 @@ impl CounterStorage for InMemoryStorage { let mut limits_by_namespace = self.limits_for_namespace.write().unwrap(); limits_by_namespace .entry(limit.namespace().clone()) - .or_insert_with(HashMap::new) + .or_default() .entry(limit.clone()) - .or_insert_with(AtomicExpiringValue::default); + .or_default(); } Ok(()) }