simplify json_url logic
This commit is contained in:
parent
a7733fc4fd
commit
1dc7f743b0
1 changed files with 8 additions and 12 deletions
18
src/ids.rs
18
src/ids.rs
|
@ -25,18 +25,14 @@ macro_rules! id_def {
|
||||||
/// Get the URL to access data about the claim on Wikidata.
|
/// Get the URL to access data about the claim on Wikidata.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn json_url(&self) -> String {
|
pub fn json_url(&self) -> String {
|
||||||
let mut ret = String::new();
|
format!(
|
||||||
ret.push_str(concat!(
|
concat!(
|
||||||
"https://www.wikidata.org/wiki/Special:EntityData/",
|
"https://www.wikidata.org/wiki/Special:EntityData/",
|
||||||
$letter
|
$letter,
|
||||||
));
|
"{}.json"
|
||||||
match self {
|
),
|
||||||
$name(num) => {
|
self.0
|
||||||
ret.push_str(&num.to_string());
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
ret.push_str(".json");
|
|
||||||
ret
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl FromStr for $name {
|
impl FromStr for $name {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue