Address inline review comments.

This commit is contained in:
ryneeverett 2023-01-15 13:28:00 -05:00 committed by Dustin J. Mitchell
parent c061d926bb
commit f56296ea93
5 changed files with 15 additions and 15 deletions

View file

@ -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<T> = core::result::Result<T, Error>;
pub type Result<T> = std::result::Result<T, Error>;

View file

@ -136,12 +136,12 @@ struct Envelope<'a> {
impl<'a> Envelope<'a> {
fn from_bytes(buf: &'a [u8]) -> Result<Envelope<'a>> {
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",
)))
}

View file

@ -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<core::result::Result<(usize, Uuid), _>> = rows.collect();
let rows: Vec<std::result::Result<(usize, Uuid), _>> = rows.collect();
let mut res = Vec::with_capacity(rows.len());
for _ in 0..self
.get_next_working_set_number()

View file

@ -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<String>) -> 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
)));

View file

@ -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<S::Ok, S::Error>
fn serialize<'a, S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
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<M>(self, mut access: M) -> core::result::Result<Self::Value, M::Error>
fn visit_map<M>(self, mut access: M) -> std::result::Result<Self::Value, M::Error>
where
M: MapAccess<'de>,
{
@ -46,7 +46,7 @@ impl<'de> Visitor<'de> for TaskDbVisitor {
}
impl<'de> Deserialize<'de> for SnapshotTasks {
fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: Deserializer<'de>,
{