diff --git a/taskchampion/taskchampion/src/errors.rs b/taskchampion/taskchampion/src/errors.rs index 348f81c33..fb2bae028 100644 --- a/taskchampion/taskchampion/src/errors.rs +++ b/taskchampion/taskchampion/src/errors.rs @@ -7,7 +7,7 @@ use thiserror::Error; pub enum Error { /// A crypto-related error #[error("Crypto Error: {0}")] - Crypto(String), + Server(String), /// A task-database-related error #[error("Task Database Error: {0}")] Database(String), @@ -18,7 +18,7 @@ pub enum Error { OutOfSync, /// A usage error #[error("User Error: {0}")] - UserError(String), + Usage(String), /// Error conversions. #[error(transparent)] @@ -35,4 +35,4 @@ pub enum Error { Sqlite(#[from] crate::storage::sqlite::SqliteError), } -pub type Result = core::result::Result; +pub type Result = std::result::Result; diff --git a/taskchampion/taskchampion/src/server/crypto.rs b/taskchampion/taskchampion/src/server/crypto.rs index 49fde3ae7..2e10a96fc 100644 --- a/taskchampion/taskchampion/src/server/crypto.rs +++ b/taskchampion/taskchampion/src/server/crypto.rs @@ -136,12 +136,12 @@ struct Envelope<'a> { impl<'a> Envelope<'a> { fn from_bytes(buf: &'a [u8]) -> Result> { if buf.len() <= 1 + aead::NONCE_LEN { - return Err(Error::Crypto(String::from("envelope is too small"))); + return Err(Error::Server(String::from("envelope is too small"))); } let version = buf[0]; if version != ENVELOPE_VERSION { - return Err(Error::Crypto(format!( + return Err(Error::Server(format!( "unrecognized encryption envelope version {}", version ))); @@ -191,7 +191,7 @@ impl Sealed { payload, }) } else { - Err(Error::Crypto(String::from( + Err(Error::Server(String::from( "Response did not have expected content-type", ))) } diff --git a/taskchampion/taskchampion/src/storage/sqlite.rs b/taskchampion/taskchampion/src/storage/sqlite.rs index 315de9cda..8abdde476 100644 --- a/taskchampion/taskchampion/src/storage/sqlite.rs +++ b/taskchampion/taskchampion/src/storage/sqlite.rs @@ -113,7 +113,7 @@ struct Txn<'t> { } impl<'t> Txn<'t> { - fn get_txn(&self) -> core::result::Result<&rusqlite::Transaction<'t>, SqliteError> { + fn get_txn(&self) -> std::result::Result<&rusqlite::Transaction<'t>, SqliteError> { self.txn .as_ref() .ok_or(SqliteError::TransactionAlreadyCommitted) @@ -305,7 +305,7 @@ impl<'t> StorageTxn for Txn<'t> { }) .context("Get working set query")?; - let rows: Vec> = rows.collect(); + let rows: Vec> = rows.collect(); let mut res = Vec::with_capacity(rows.len()); for _ in 0..self .get_next_working_set_number() diff --git a/taskchampion/taskchampion/src/task/task.rs b/taskchampion/taskchampion/src/task/task.rs index e470d2b64..ba57e95cb 100644 --- a/taskchampion/taskchampion/src/task/task.rs +++ b/taskchampion/taskchampion/src/task/task.rs @@ -418,7 +418,7 @@ impl<'r> TaskMut<'r> { /// Add a tag to this task. Does nothing if the tag is already present. pub fn add_tag(&mut self, tag: &Tag) -> Result<()> { if tag.is_synthetic() { - return Err(Error::UserError(String::from( + return Err(Error::Usage(String::from( "Synthetic tags cannot be modified", ))); } @@ -428,7 +428,7 @@ impl<'r> TaskMut<'r> { /// Remove a tag from this task. Does nothing if the tag is not present. pub fn remove_tag(&mut self, tag: &Tag) -> Result<()> { if tag.is_synthetic() { - return Err(Error::UserError(String::from( + return Err(Error::Usage(String::from( "Synthetic tags cannot be modified", ))); } @@ -476,7 +476,7 @@ impl<'r> TaskMut<'r> { ) -> Result<()> { let key = key.into(); if Task::is_known_key(&key) { - return Err(Error::UserError(format!( + return Err(Error::Usage(format!( "Property name {} as special meaning in a task and cannot be used as a UDA", key ))); @@ -488,7 +488,7 @@ impl<'r> TaskMut<'r> { pub fn remove_legacy_uda(&mut self, key: impl Into) -> Result<()> { let key = key.into(); if Task::is_known_key(&key) { - return Err(Error::UserError(format!( + return Err(Error::Usage(format!( "Property name {} as special meaning in a task and cannot be used as a UDA", key ))); diff --git a/taskchampion/taskchampion/src/taskdb/snapshot.rs b/taskchampion/taskchampion/src/taskdb/snapshot.rs index a7563e7e7..055ff9d89 100644 --- a/taskchampion/taskchampion/src/taskdb/snapshot.rs +++ b/taskchampion/taskchampion/src/taskdb/snapshot.rs @@ -10,7 +10,7 @@ use uuid::Uuid; pub(super) struct SnapshotTasks(Vec<(Uuid, TaskMap)>); impl Serialize for SnapshotTasks { - fn serialize<'a, S>(&self, serializer: S) -> core::result::Result + fn serialize<'a, S>(&self, serializer: S) -> std::result::Result where S: Serializer, { @@ -31,7 +31,7 @@ impl<'de> Visitor<'de> for TaskDbVisitor { formatter.write_str("a map representing a task snapshot") } - fn visit_map(self, mut access: M) -> core::result::Result + fn visit_map(self, mut access: M) -> std::result::Result where M: MapAccess<'de>, { @@ -46,7 +46,7 @@ impl<'de> Visitor<'de> for TaskDbVisitor { } impl<'de> Deserialize<'de> for SnapshotTasks { - fn deserialize(deserializer: D) -> core::result::Result + fn deserialize(deserializer: D) -> std::result::Result where D: Deserializer<'de>, {