From 57f80ebde295cbe8179b757aef1c0b13c0b89480 Mon Sep 17 00:00:00 2001 From: nyyu Date: Sun, 1 Aug 2021 09:56:15 +0200 Subject: [PATCH] fix clippy errors --- src/cgg_data_source.rs | 51 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/src/cgg_data_source.rs b/src/cgg_data_source.rs index 5780ce2..f02df42 100644 --- a/src/cgg_data_source.rs +++ b/src/cgg_data_source.rs @@ -86,7 +86,7 @@ impl CGGDataSource { .collect::>() .join(""); - self.make_item_set(build, [label, &key_order.as_str()].join(" ").as_str()) + self.make_item_set(build, [label, key_order.as_str()].join(" ").as_str()) } } @@ -113,10 +113,10 @@ impl DataSource for CGGDataSource { let page = &req.into_string().unwrap(); let datas: BuildResponse = - serde_json::from_str(&extract_json("window.__PRELOADED_STATE__ = ", &page)).unwrap(); + serde_json::from_str(&extract_json("window.__PRELOADED_STATE__ = ", page)).unwrap(); let champs_stats: HashMap = - serde_json::from_str(&extract_json("window.__FLASH_CMS_APOLLO_STATE__ = ", &page)) + serde_json::from_str(&extract_json("window.__FLASH_CMS_APOLLO_STATE__ = ", page)) .unwrap(); for entry in champs_stats.iter() { CHAMPIONS_STATS @@ -161,33 +161,28 @@ impl DataSource for CGGDataSource { } } if let Some(champ) = some_champ { - let mut blocks = vec![]; - - blocks.push(self.make_item_set_from_list( - &champ.stats.starting_items, - "Highest % Win Starting Items | Skills: ", - &champ.stats.skills, - )); - blocks.push( + let blocks = vec![ + self.make_item_set_from_list( + &champ.stats.starting_items, + "Highest % Win Starting Items | Skills: ", + &champ.stats.skills, + ), self.make_item_set(&champ.stats.core_builds, "Highest % Win Core Build Path:"), - ); - blocks.push( self.make_item_set(&champ.stats.big_item_builds, "Highest % Win Big Items:"), - ); - - blocks.push(self.make_item_set_from_list( - &champ.stats.most_common_starting_items, - "Most Frequent Starting Items | Skills: ", - &champ.stats.most_common_skills, - )); - blocks.push(self.make_item_set( - &champ.stats.most_common_core_builds, - "Most Frequent Build Path", - )); - blocks.push(self.make_item_set( - &champ.stats.most_common_big_item_builds, - "Most Frequent Big Items:", - )); + self.make_item_set_from_list( + &champ.stats.most_common_starting_items, + "Most Frequent Starting Items | Skills: ", + &champ.stats.most_common_skills, + ), + self.make_item_set( + &champ.stats.most_common_core_builds, + "Most Frequent Build Path", + ), + self.make_item_set( + &champ.stats.most_common_big_item_builds, + "Most Frequent Big Items:", + ), + ]; let mut key: String = String::new(); let champs_stats = CHAMPIONS_STATS.lock().unwrap();