mirror of
https://github.com/MingweiSamuel/Riven.git
synced 2025-01-30 04:37:26 -08:00
Clippy
This commit is contained in:
parent
6f49cce887
commit
d85fdb16cb
2 changed files with 9 additions and 13 deletions
|
@ -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<Duration> {
|
||||
|
|
|
@ -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<Output = Result<ResponseInfo>> + '_ {
|
||||
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<ResponseInfo> {
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue