derive some defaults to make clippy happy

This commit is contained in:
Abraham Toriz 2023-03-14 16:04:57 -05:00
parent 22d16ff5ba
commit 08ff8254d1
No known key found for this signature in database
GPG Key ID: D5B4A746DB5DD42A
3 changed files with 6 additions and 19 deletions

View File

@ -29,18 +29,14 @@ fn beginning_of_previous_month(time: DateTime<Local>) -> DateTime<Utc> {
} }
} }
#[derive(Default)]
enum MonthSpec { enum MonthSpec {
Last, Last,
#[default]
This, This,
Month(u32), Month(u32),
} }
impl Default for MonthSpec {
fn default() -> MonthSpec {
MonthSpec::This
}
}
impl FromStr for MonthSpec { impl FromStr for MonthSpec {
type Err = Error; type Err = Error;

View File

@ -12,18 +12,14 @@ use crate::io::Streams;
use crate::interactive::note_from_last_entries; use crate::interactive::note_from_last_entries;
use super::{Command, Facts, r#in, sheet}; use super::{Command, Facts, r#in, sheet};
#[derive(Default)]
enum SelectedEntry { enum SelectedEntry {
Id(u64), Id(u64),
Interactive, Interactive,
#[default]
NotSpecified, NotSpecified,
} }
impl Default for SelectedEntry {
fn default() -> Self {
SelectedEntry::NotSpecified
}
}
#[derive(Default)] #[derive(Default)]
pub struct Args { pub struct Args {
entry: SelectedEntry, entry: SelectedEntry,

View File

@ -15,9 +15,10 @@ pub mod ical;
pub mod custom; pub mod custom;
pub mod chart; pub mod chart;
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum Formatter { pub enum Formatter {
#[default]
Text, Text,
Csv, Csv,
Json, Json,
@ -27,12 +28,6 @@ pub enum Formatter {
Custom(String), Custom(String),
} }
impl Default for Formatter {
fn default() -> Formatter {
Formatter::Text
}
}
impl Formatter { impl Formatter {
/// Prints the given entries to the specified output device. /// Prints the given entries to the specified output device.
/// ///