From 1dc7f743b0ab1bcc4c8e11b16e6069a8354b92da Mon Sep 17 00:00:00 2001 From: Smitty Date: Sat, 29 May 2021 11:36:16 -0400 Subject: [PATCH] simplify json_url logic --- src/ids.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/ids.rs b/src/ids.rs index afe7d95..c214822 100755 --- a/src/ids.rs +++ b/src/ids.rs @@ -25,18 +25,14 @@ macro_rules! id_def { /// Get the URL to access data about the claim on Wikidata. #[must_use] pub fn json_url(&self) -> String { - let mut ret = String::new(); - ret.push_str(concat!( - "https://www.wikidata.org/wiki/Special:EntityData/", - $letter - )); - match self { - $name(num) => { - ret.push_str(&num.to_string()); - } - } - ret.push_str(".json"); - ret + format!( + concat!( + "https://www.wikidata.org/wiki/Special:EntityData/", + $letter, + "{}.json" + ), + self.0 + ) } } impl FromStr for $name {