From cb941f503b91d207cabbf98f7b49394a6c747737 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sat, 13 Feb 2021 17:02:49 -0700 Subject: Make priority a string type --- examples/import_task.rs | 2 +- src/import.rs | 2 +- src/priority.rs | 19 +++---------------- src/task.rs | 2 +- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/examples/import_task.rs b/examples/import_task.rs index d1a481b..ca6ba04 100644 --- a/examples/import_task.rs +++ b/examples/import_task.rs @@ -15,7 +15,7 @@ fn main() { assert_eq!(*t.status(), TaskStatus::Pending); assert_eq!(*t.description(), "Test task".to_owned()); assert_eq!(t.priority(), None); + assert_eq!(t.uda().get("priority"), None); println!("Successfully imported:\n{:?}", t); } - diff --git a/src/import.rs b/src/import.rs index 68009b1..3d6c4e9 100644 --- a/src/import.rs +++ b/src/import.rs @@ -165,7 +165,7 @@ fn test_one_single() { assert!(task.project() == Some(&String::from("someproject"))); if let Some(tags) = task.tags() { for tag in tags { - let any_tag = ["some", "tags", "are", "here"].into_iter().any( + let any_tag = ["some", "tags", "are", "here"].iter().any( |t| tag == *t, ); assert!(any_tag, "Tag {} missing", tag); diff --git a/src/priority.rs b/src/priority.rs index b0d33a4..6a04763 100644 --- a/src/priority.rs +++ b/src/priority.rs @@ -4,20 +4,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // -//! Module containing TaskPriority types and trait impls +//! Module containing `TaskPriority` type -/// Enum for the priorities taskwarrior supports. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub enum TaskPriority { - /// Low prio for a Task - #[serde(rename = "L")] - Low, - - /// Medium prio for a Task - #[serde(rename = "M")] - Medium, - - /// High prio for a Task - #[serde(rename = "H")] - High, -} +/// type definition for TaskPriority +pub type TaskPriority = String; diff --git a/src/task.rs b/src/task.rs index 89d35d9..3fa0c12 100644 --- a/src/task.rs +++ b/src/task.rs @@ -932,7 +932,7 @@ mod test { if let Some(tags) = task.tags() { for tag in tags { - let any_tag = ["some", "tags", "are", "here"].into_iter().any( + let any_tag = ["some", "tags", "are", "here"].iter().any( |t| tag == *t, ); assert!(any_tag, "Tag {} missing", tag); -- cgit v1.2.3