fix clippy errors

This commit is contained in:
nyyu 2021-08-01 09:56:15 +02:00
parent 562bedbcbf
commit 57f80ebde2

View file

@ -86,7 +86,7 @@ impl CGGDataSource {
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join(""); .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 page = &req.into_string().unwrap();
let datas: BuildResponse = 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<String, ChampStat> = let champs_stats: HashMap<String, ChampStat> =
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(); .unwrap();
for entry in champs_stats.iter() { for entry in champs_stats.iter() {
CHAMPIONS_STATS CHAMPIONS_STATS
@ -161,33 +161,28 @@ impl DataSource for CGGDataSource {
} }
} }
if let Some(champ) = some_champ { if let Some(champ) = some_champ {
let mut blocks = vec![]; let blocks = vec![
self.make_item_set_from_list(
blocks.push(self.make_item_set_from_list(
&champ.stats.starting_items, &champ.stats.starting_items,
"Highest % Win Starting Items | Skills: ", "Highest % Win Starting Items | Skills: ",
&champ.stats.skills, &champ.stats.skills,
)); ),
blocks.push(
self.make_item_set(&champ.stats.core_builds, "Highest % Win Core Build Path:"), 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:"), self.make_item_set(&champ.stats.big_item_builds, "Highest % Win Big Items:"),
); self.make_item_set_from_list(
blocks.push(self.make_item_set_from_list(
&champ.stats.most_common_starting_items, &champ.stats.most_common_starting_items,
"Most Frequent Starting Items | Skills: ", "Most Frequent Starting Items | Skills: ",
&champ.stats.most_common_skills, &champ.stats.most_common_skills,
)); ),
blocks.push(self.make_item_set( self.make_item_set(
&champ.stats.most_common_core_builds, &champ.stats.most_common_core_builds,
"Most Frequent Build Path", "Most Frequent Build Path",
)); ),
blocks.push(self.make_item_set( self.make_item_set(
&champ.stats.most_common_big_item_builds, &champ.stats.most_common_big_item_builds,
"Most Frequent Big Items:", "Most Frequent Big Items:",
)); ),
];
let mut key: String = String::new(); let mut key: String = String::new();
let champs_stats = CHAMPIONS_STATS.lock().unwrap(); let champs_stats = CHAMPIONS_STATS.lock().unwrap();