diff --git a/src/eval/command.rs b/src/eval/command.rs index 893bbaf..f27932e 100644 --- a/src/eval/command.rs +++ b/src/eval/command.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use chrono::NaiveDate; use crate::files::commands::{BirthdaySpec, Command, Done, Note, Span, Spec, Statement, Task}; -use crate::files::{Source, SourcedCommand}; +use crate::files::SourcedCommand; use super::date::Dates; use super::{DateRange, Entry, EntryKind, Error, Result}; diff --git a/src/files/commands.rs b/src/files/commands.rs index b6d5069..34fe17b 100644 --- a/src/files/commands.rs +++ b/src/files/commands.rs @@ -1,4 +1,4 @@ -use std::{cmp, fmt}; +use std::fmt; use chrono::NaiveDate; @@ -389,40 +389,6 @@ pub enum DoneDate { }, } -impl DoneDate { - pub fn root(&self) -> NaiveDate { - match self { - DoneDate::Date { root } => *root, - DoneDate::DateWithTime { root, .. } => *root, - DoneDate::DateToDate { root, .. } => *root, - DoneDate::DateToDateWithTime { root, .. } => *root, - } - } - - pub fn other(&self) -> Option { - match self { - DoneDate::Date { .. } => None, - DoneDate::DateWithTime { .. } => None, - DoneDate::DateToDate { other, .. } => Some(*other), - DoneDate::DateToDateWithTime { other, .. } => Some(*other), - } - } - - pub fn first(&self) -> NaiveDate { - match self.other() { - None => self.root(), - Some(other) => cmp::min(self.root(), other), - } - } - - pub fn last(&self) -> NaiveDate { - match self.other() { - None => self.root(), - Some(other) => cmp::max(self.root(), other), - } - } -} - #[derive(Debug)] pub struct Done { pub date: Option, @@ -450,22 +416,6 @@ pub enum Command { Note(Note), } -impl Command { - pub fn title(&self) -> &str { - match self { - Command::Task(task) => &task.title, - Command::Note(note) => ¬e.title, - } - } - - pub fn desc(&self) -> &[String] { - match self { - Command::Task(task) => &task.desc, - Command::Note(note) => ¬e.desc, - } - } -} - #[derive(Debug)] pub struct File { pub contents: String, diff --git a/src/files/format.rs b/src/files/format.rs index 52e777a..e3eab50 100644 --- a/src/files/format.rs +++ b/src/files/format.rs @@ -219,7 +219,7 @@ impl fmt::Display for Statement { Statement::Until(Some(date)) => writeln!(f, "UNTIL {}", date), Statement::Until(None) => writeln!(f, "UNTIL *"), Statement::Except(date) => writeln!(f, "EXCEPT {}", date), - Statement::Move { span, from, to } => writeln!(f, "MOVE {} TO {}", from, to), + Statement::Move { from, to, .. } => writeln!(f, "MOVE {} TO {}", from, to), } } }