diff --git a/src/commands/month.rs b/src/commands/month.rs index 9743e5c..2f1ec0d 100644 --- a/src/commands/month.rs +++ b/src/commands/month.rs @@ -29,18 +29,14 @@ fn beginning_of_previous_month(time: DateTime) -> DateTime { } } +#[derive(Default)] enum MonthSpec { Last, + #[default] This, Month(u32), } -impl Default for MonthSpec { - fn default() -> MonthSpec { - MonthSpec::This - } -} - impl FromStr for MonthSpec { type Err = Error; diff --git a/src/commands/resume.rs b/src/commands/resume.rs index 3ba9426..4f530e1 100644 --- a/src/commands/resume.rs +++ b/src/commands/resume.rs @@ -12,18 +12,14 @@ use crate::io::Streams; use crate::interactive::note_from_last_entries; use super::{Command, Facts, r#in, sheet}; +#[derive(Default)] enum SelectedEntry { Id(u64), Interactive, + #[default] NotSpecified, } -impl Default for SelectedEntry { - fn default() -> Self { - SelectedEntry::NotSpecified - } -} - #[derive(Default)] pub struct Args { entry: SelectedEntry, diff --git a/src/formatters.rs b/src/formatters.rs index a88a0d8..6617658 100644 --- a/src/formatters.rs +++ b/src/formatters.rs @@ -15,9 +15,10 @@ pub mod ical; pub mod custom; pub mod chart; -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Formatter { + #[default] Text, Csv, Json, @@ -27,12 +28,6 @@ pub enum Formatter { Custom(String), } -impl Default for Formatter { - fn default() -> Formatter { - Formatter::Text - } -} - impl Formatter { /// Prints the given entries to the specified output device. ///