diff --git a/src/cgg_data_source.rs b/src/cgg_data_source.rs index 3bac343..de311ac 100644 --- a/src/cgg_data_source.rs +++ b/src/cgg_data_source.rs @@ -90,12 +90,11 @@ impl CGGDataSource { } fn extract_json(pattern: &str, page: &str) -> String { - - let json = page[page.find(pattern).unwrap()+pattern.len()..].to_owned(); - json[..json.find("};").unwrap()+1].replace("undefined", "null").to_owned() + let json = page[page.find(pattern).unwrap() + pattern.len()..].to_owned(); + json[..json.find("};").unwrap() + 1] + .replace("undefined", "null") } - impl DataSource for CGGDataSource { fn get_alias(&self) -> &str { "CGG" @@ -116,8 +115,8 @@ impl DataSource for CGGDataSource { 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)).unwrap(); - + serde_json::from_str(&extract_json("window.__FLASH_CMS_APOLLO_STATE__ = ", &page)) + .unwrap(); for entry in champs_stats.iter() { CHAMPIONS_STATS .lock() diff --git a/src/kb_data_source.rs b/src/kb_data_source.rs index a1584da..f54bf0e 100644 --- a/src/kb_data_source.rs +++ b/src/kb_data_source.rs @@ -114,15 +114,15 @@ impl KBDataSource { None => return None, }; bundle = (&bundle[(auth_position + 13)..]).to_string(); - let q_position = match bundle.find("\"") { + let q_position = match bundle.find('"') { Some(position) => position, None => return None, }; bundle = (&bundle[(q_position + 1)..]).to_string(); - return match bundle.find("\"") { + match bundle.find('"') { Some(position) => Some((&bundle[..position]).to_string()), None => None, - }; + } } fn get_classname_mapping(&self, client: &ureq::Agent) -> IndexMap {