Get rid of some warnings
This commit is contained in:
parent
8d49ac139a
commit
9920b00916
3 changed files with 3 additions and 53 deletions
|
|
@ -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<NaiveDate> {
|
||||
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<DoneDate>,
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue