Skip to content

Commit ff9f767

Browse files
committed
feat: remove Establishment dates for some countries
Some countries have complicated history and may have multiple establishment dates. It may be controversial to choose a specific establishment date for some of them, and especially since I personally don't know about the intricate policits surrounding each of the 200 countries I'll remove them. Closes #19 Closes #18 Closes #7
1 parent d2dbf0e commit ff9f767

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/country_format.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ pub fn format_country(
393393
|c| c.neighbours.clone(),
394394
)),
395395
established_date: (!args.no_established_date)
396-
.then_some(extra_country_data::established_date(gen_country)),
396+
.then(|| extra_country_data::established_date(gen_country))
397+
.flatten(),
397398
iso_codes: (!args.no_iso_codes).then_some(country.map_or_else(
398399
|| {
399400
(

src/extra_country_data.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ pub fn currency_position(country: Country) -> CurrencyPosition {
8585

8686
/// The date when each country was established
8787
#[allow(clippy::match_same_arms, reason = "readability")]
88-
pub fn established_date(country: Country) -> &'static str {
89-
match country {
88+
pub fn established_date(country: Country) -> Option<&'static str> {
89+
Some(match country {
9090
Country::Afghanistan => "August 19, 1919",
9191
Country::AlandIslands => "December 6, 1917",
9292
Country::Albania => "November 28, 1912",
@@ -264,7 +264,7 @@ pub fn established_date(country: Country) -> &'static str {
264264
Country::Peru => "July 28, 1821",
265265
Country::Philippines => "June 12, 1898",
266266
Country::PitcairnIslands => "January 15, 1790",
267-
Country::Poland => "November 11, 1918",
267+
Country::Poland => return None,
268268
Country::Portugal => "October 5, 1143",
269269
Country::PuertoRico => "July 25, 1952",
270270
Country::Qatar => "September 3, 1971",
@@ -297,7 +297,7 @@ pub fn established_date(country: Country) -> &'static str {
297297
Country::SouthGeorgia => "May 3, 1985",
298298
Country::SouthKorea => "August 15, 1948",
299299
Country::SouthSudan => "July 9, 2011",
300-
Country::Spain => "December 6, 1978",
300+
Country::Spain => return None,
301301
Country::SriLanka => "February 4, 1948",
302302
Country::Sudan => "January 1, 1956",
303303
Country::Suriname => "November 25, 1975",
@@ -337,5 +337,5 @@ pub fn established_date(country: Country) -> &'static str {
337337
Country::Yemen => "May 22, 1990",
338338
Country::Zambia => "October 24, 1964",
339339
Country::Zimbabwe => "April 18, 1980",
340-
}
340+
})
341341
}

src/generated_country_data.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
#![allow(clippy::should_implement_trait)]
55
#![allow(clippy::needless_arbitrary_self_type)]
66

7-
pub mod extras;
8-
pub use extras::*;
9-
107
#[derive(Eq, PartialEq, Copy, Clone, Ord, PartialOrd, Debug, clap::ValueEnum)]
118
#[clap(rename_all = "PascalCase")]
129
pub enum Country {

0 commit comments

Comments
 (0)