From 14d90bcbe6cef70d0ab99cb3285038fbd6385efa Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 12 Nov 2021 13:10:14 +0100 Subject: Update dependencies Only minor changes are needed. --- src/guilds.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/guilds.rs') diff --git a/src/guilds.rs b/src/guilds.rs index 24ec817..e847841 100644 --- a/src/guilds.rs +++ b/src/guilds.rs @@ -39,16 +39,11 @@ pub fn lookup(api_id: &str) -> Option { let mut cache = CACHE.write().unwrap(); let url = format!("https://api.guildwars2.com/v2/guild/{}", api_id); - let result = ureq::get(&url) + let guild: Guild = ureq::get(&url) .call() + .ok()? .into_json() .expect("Invalid JSON in API response"); - let name = result["name"].as_str()?; - let tag = result["tag"].as_str()?; - let guild = Guild { - tag: tag.into(), - name: name.into(), - }; cache.insert(api_id.into(), guild.clone()); Some(guild) } -- cgit v1.2.3