Get rid of some warnings

This commit is contained in:
Joscha 2021-12-05 18:39:53 +01:00
parent 8d49ac139a
commit 9920b00916
3 changed files with 3 additions and 53 deletions

View file

@ -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) => &note.title,
}
}
pub fn desc(&self) -> &[String] {
match self {
Command::Task(task) => &task.desc,
Command::Note(note) => &note.desc,
}
}
}
#[derive(Debug)]
pub struct File {
pub contents: String,