Replace ApiVersion's impl with derive
- Replace the "Default" `impl` with a `#[derive()]` in config/general - That's simpler, no extra functions
This commit is contained in:
parent
ccf9e8225f
commit
f918795e69
@ -2,9 +2,10 @@ use serde::Deserialize;
|
||||
|
||||
const DEFAULT_CACHE_FILE: &str = "~/.cache/candydesktop/owm_widget.json";
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Deserialize, PartialEq, Default)]
|
||||
pub enum ApiVersion {
|
||||
#[serde(rename = "free_2.5")]
|
||||
#[default]
|
||||
Free25,
|
||||
#[serde(rename = "onecall_3.0")]
|
||||
OneCall30,
|
||||
@ -12,12 +13,6 @@ pub enum ApiVersion {
|
||||
// ...
|
||||
}
|
||||
|
||||
impl Default for ApiVersion {
|
||||
fn default() -> Self {
|
||||
Self::Free25
|
||||
}
|
||||
}
|
||||
|
||||
fn default_api_version() -> ApiVersion {
|
||||
ApiVersion::default()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user