style: cleanups for clippy

This commit is contained in:
Mingwei Samuel 2024-11-03 22:46:47 -08:00
parent 78c88a0a3f
commit a7f72cd21a
3 changed files with 102 additions and 106 deletions

View file

@ -13,6 +13,5 @@ pub use token_bucket::*;
mod regional_requester; mod regional_requester;
pub use regional_requester::*; pub use regional_requester::*;
#[cfg(test)]
#[path = "token_bucket.test.rs"] #[path = "token_bucket.test.rs"]
mod token_bucket_test; mod token_bucket_test;

View file

@ -1,4 +1,3 @@
use std::future::Future;
use memo_map::MemoMap; use memo_map::MemoMap;
use reqwest::{RequestBuilder, StatusCode}; use reqwest::{RequestBuilder, StatusCode};
@ -30,13 +29,12 @@ impl RegionalRequester {
} }
} }
pub fn execute<'a>( pub async fn execute<'a>(
&'a self, &'a self,
config: &'a RiotApiConfig, config: &'a RiotApiConfig,
method_id: &'static str, method_id: &'static str,
request: RequestBuilder, request: RequestBuilder,
) -> impl Future<Output = Result<ResponseInfo>> + 'a { ) -> Result<ResponseInfo> {
async move {
let mut retries: u8 = 0; let mut retries: u8 = 0;
loop { loop {
let method_rate_limit = self let method_rate_limit = self
@ -144,7 +142,6 @@ impl RegionalRequester {
} }
} }
} }
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View file

@ -318,7 +318,7 @@ pub async fn spectator_v5_combo(route: PlatformRoute) -> Result<(), String> {
let livegame_p = riot_api() let livegame_p = riot_api()
.spectator_v5() .spectator_v5()
.get_current_game_info_by_puuid(route, &puuid); .get_current_game_info_by_puuid(route, puuid);
let livegame_o = livegame_p.await.map_err(|e| { let livegame_o = livegame_p.await.map_err(|e| {
format!( format!(
"Failed to get live game {} for summoner PUUID {}: {}", "Failed to get live game {} for summoner PUUID {}: {}",
@ -360,7 +360,7 @@ pub async fn spectator_tft_v5_combo(route: PlatformRoute) -> Result<(), String>
let livegame_p = riot_api() let livegame_p = riot_api()
.spectator_tft_v5() .spectator_tft_v5()
.get_current_game_info_by_puuid(route, &puuid); .get_current_game_info_by_puuid(route, puuid);
let livegame_o = livegame_p.await.map_err(|e| { let livegame_o = livegame_p.await.map_err(|e| {
format!( format!(
"Failed to get live game {} for summoner PUUID {}: {}", "Failed to get live game {} for summoner PUUID {}: {}",