summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-12-18 11:07:28 +0000
committerGitHub <noreply@github.com>2022-12-18 11:07:28 +0000
commitfe836ce049352315a983fffded9bc7f15040af1b (patch)
tree9a8971a31eba958bfd414aa3c6ce1068912e6c0e
parent502321914005b101fa8bae7e979453876bc9c64b (diff)
parentc45f532753d58725762ca4b4d3be82414675e48f (diff)
Merge #21
21: Cleanup r=matthiasbeyer a=matthiasbeyer Some misc code cleanup. Co-authored-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--Cargo.toml13
-rw-r--r--src/annotation.rs2
-rw-r--r--src/error.rs2
-rw-r--r--src/import.rs2
-rw-r--r--src/lib.rs16
-rw-r--r--src/status.rs2
-rw-r--r--src/task.rs6
-rw-r--r--src/tw.rs2
8 files changed, 14 insertions, 31 deletions
diff --git a/Cargo.toml b/Cargo.toml
index f168f8f..0888d1d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,14 +20,13 @@ resolver = "2"
maintenance = { status = "passively-maintained" }
[dependencies]
-chrono = "0.4"
-serde = "1"
-serde_derive = "1"
-serde_json = "1"
-uuid = { version = "1.2", features = ["serde", "v4"] }
-log = "0.4"
+chrono = "0.4"
+serde = { version = "1", features = ["derive"] }
+serde_json = "1"
+uuid = { version = "1.2", features = ["serde", "v4"] }
+log = "0.4"
derive_builder = "0.12.0"
-failure = "0.1"
+failure = "0.1"
[dev-dependencies]
env_logger = "0.10"
diff --git a/src/annotation.rs b/src/annotation.rs
index a4e5b76..6f5a4e0 100644
--- a/src/annotation.rs
+++ b/src/annotation.rs
@@ -11,7 +11,7 @@ use crate::date::Date;
/// Annotation type for task annotations.
/// Each annotation in taskwarrior consists of a date and a description,
/// the date is named "entry", the description "description" in the JSON export.
-#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
+#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq)]
pub struct Annotation {
entry: Date,
description: String,
diff --git a/src/error.rs b/src/error.rs
index af4dfd5..6469c26 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -7,7 +7,7 @@
//! Definitions for error handling with failure
/// Failure error kind type, defining error messages
-#[derive(Debug, Clone, Eq, PartialEq, Fail)]
+#[derive(Debug, Clone, Eq, PartialEq, failure::Fail)]
pub enum ErrorKind {
/// Error kind indicating that the JSON parser failed
#[fail(display = "Failed to create a Task from JSON")]
diff --git a/src/import.rs b/src/import.rs
index 64ed423..19acd0e 100644
--- a/src/import.rs
+++ b/src/import.rs
@@ -131,10 +131,10 @@ fn test_two() {
#[test]
fn test_one_single() {
- use chrono::NaiveDateTime;
use crate::date::Date;
use crate::date::TASKWARRIOR_DATETIME_TEMPLATE;
use crate::status::TaskStatus;
+ use chrono::NaiveDateTime;
use uuid::Uuid;
fn mkdate(s: &str) -> Date {
let n = NaiveDateTime::parse_from_str(s, TASKWARRIOR_DATETIME_TEMPLATE);
diff --git a/src/lib.rs b/src/lib.rs
index edf9a24..3f9ae99 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -43,22 +43,6 @@
while_true
)]
-extern crate chrono;
-extern crate serde;
-#[macro_use]
-extern crate serde_derive;
-extern crate serde_json;
-extern crate uuid;
-#[macro_use]
-extern crate derive_builder;
-#[macro_use]
-extern crate failure;
-
-#[cfg(test)]
-extern crate env_logger;
-#[macro_use]
-extern crate log;
-
pub mod annotation;
pub mod date;
pub mod error;
diff --git a/src/status.rs b/src/status.rs
index 145b39d..f049983 100644
--- a/src/status.rs
+++ b/src/status.rs
@@ -9,7 +9,7 @@
use std::fmt::{Display, Error as FmtError, Formatter};
/// Enum for status taskwarrior supports.
-#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
+#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum TaskStatus {
/// Pending status type
#[serde(rename = "pending")]
diff --git a/src/task.rs b/src/task.rs
index d44852c..8cf65d7 100644
--- a/src/task.rs
+++ b/src/task.rs
@@ -41,7 +41,7 @@ use crate::urgency::Urgency;
///
/// It is deserializeable and serializeable via serde_json, so importing and exporting taskwarrior
/// tasks is simply serializing and deserializing objects of this type.
-#[derive(Debug, Clone, PartialEq, Builder)]
+#[derive(Debug, Clone, PartialEq, derive_builder::Builder)]
#[builder(setter(into))]
pub struct Task {
/// The temporary assigned task id
@@ -774,7 +774,7 @@ impl<'de> Visitor<'de> for TaskDeserializeVisitor {
}
field => {
- debug!("Inserting '{}' as UDA", field);
+ log::debug!("Inserting '{}' as UDA", field);
let uda_value: UDAValue = visitor.next_value()?;
uda.insert(UDAName::from(field), uda_value);
}
@@ -831,7 +831,7 @@ mod test {
fn mklogger() {
let _ = env_logger::init();
- debug!("Env-logger enabled");
+ log::debug!("Env-logger enabled");
}
fn mkdate(s: &str) -> Date {
diff --git a/src/tw.rs b/src/tw.rs
index dea6b07..0a4f1d9 100644
--- a/src/tw.rs
+++ b/src/tw.rs
@@ -10,10 +10,10 @@
use crate::error::ErrorKind as EK;
use crate::import::import;
+use crate::task::Task;
use std::io::Write;
use std::iter::once;
use std::process::{Child, Command, Stdio};
-use crate::task::Task;
use failure::Fallible as Result;
use failure::ResultExt;