diff --git a/riven/src/req/token_bucket.rs b/riven/src/req/token_bucket.rs index a867c02..758d19e 100644 --- a/riven/src/req/token_bucket.rs +++ b/riven/src/req/token_bucket.rs @@ -136,7 +136,7 @@ impl VectorTokenBucket { impl TokenBucket for VectorTokenBucket { fn get_capacity(&self) -> f32 { - if self.total_limit <= 0 { + if self.total_limit == 0 { // Handle edge cases by telling the caller we have no capacity. return -1.0; } @@ -147,7 +147,7 @@ impl TokenBucket for VectorTokenBucket { return -1.0; } - return 1.0 - (timestamps.len() as f32 / self.total_limit as f32); + 1.0 - (timestamps.len() as f32 / self.total_limit as f32) } fn get_delay(&self) -> Option { diff --git a/riven/src/riot_api.rs b/riven/src/riot_api.rs index d2e3859..c293970 100644 --- a/riven/src/riot_api.rs +++ b/riven/src/riot_api.rs @@ -237,7 +237,7 @@ impl RiotApi { Err(e) => Some(Err(e)), } } else { - return None; + None } } @@ -296,20 +296,16 @@ impl RiotApi { /// /// # Returns /// A future resolving to a `Result` containg either a `ResponseInfo` (success) or a `RiotApiError` (failure). - pub fn execute_raw( + pub async fn execute_raw( &self, method_id: &'static str, region_platform: &'static str, request: RequestBuilder, - ) -> impl Future> + '_ { - async move { - self.regional_requester(region_platform) - .execute(&self.config, method_id, request, None) - .await - .expect( - "regional_requester.excute only returns None when min_capacity is Some(f32)", - ) - } + ) -> Result { + self.regional_requester(region_platform) + .execute(&self.config, method_id, request, None) + .await + .expect("regional_requester.excute only returns None when min_capacity is Some(f32)") } /// This method should generally not be used directly. Consider using endpoint wrappers instead.