aboutsummaryrefslogtreecommitdiff
path: root/src/api/error.rs
diff options
context:
space:
mode:
authorTrinity Pointard <trinity.pointard@gmail.com>2021-04-23 22:18:00 +0200
committerAlex Auvolat <alex@adnab.me>2021-05-03 22:11:41 +0200
commit84856e84e5c7ccbb6cb32582c1ef71acc83396f5 (patch)
treec40ba4a3ba74d24941748c50026c43929938e1b1 /src/api/error.rs
parent4a1e079e8fe2c17078a274ef17c8d63e9b1bb96e (diff)
downloadgarage-84856e84e5c7ccbb6cb32582c1ef71acc83396f5.tar.gz
garage-84856e84e5c7ccbb6cb32582c1ef71acc83396f5.zip
fix clippy warnings on api
Diffstat (limited to 'src/api/error.rs')
-rw-r--r--src/api/error.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/api/error.rs b/src/api/error.rs
index bd340fa6..eaa6c3a1 100644
--- a/src/api/error.rs
+++ b/src/api/error.rs
@@ -8,6 +8,7 @@ use garage_util::error::Error as GarageError;
use crate::encoding::*;
/// Errors of this crate
+#[allow(clippy::upper_case_acronyms)]
#[derive(Debug, Error)]
pub enum Error {
// Category: internal error
@@ -140,7 +141,7 @@ impl<T> OkOrBadRequest for Option<T> {
fn ok_or_bad_request(self, reason: &'static str) -> Result<T, Error> {
match self {
Some(x) => Ok(x),
- None => Err(Error::BadRequest(format!("{}", reason))),
+ None => Err(Error::BadRequest(reason.to_string())),
}
}
}
@@ -172,10 +173,9 @@ impl<T> OkOrInternalError for Option<T> {
fn ok_or_internal_error(self, reason: &'static str) -> Result<T, Error> {
match self {
Some(x) => Ok(x),
- None => Err(Error::InternalError(GarageError::Message(format!(
- "{}",
- reason
- )))),
+ None => Err(Error::InternalError(GarageError::Message(
+ reason.to_string(),
+ ))),
}
}
}