diff --git a/middleware/middleware-rate-limit/src/rate_limit.rs b/middleware/middleware-rate-limit/src/rate_limit.rs index f6f83654..53514c6c 100644 --- a/middleware/middleware-rate-limit/src/rate_limit.rs +++ b/middleware/middleware-rate-limit/src/rate_limit.rs @@ -110,12 +110,12 @@ impl TokenBucket { self.tokens = min(self.tokens + tokens_to_add, self.capacity); - return if self.tokens > 0 { + if self.tokens > 0 { self.last_query_time = current_time; - self.tokens = self.tokens - 1; + self.tokens -= 1; true } else { false - }; + } } }