mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-12 07:16:52 +00:00
fix clippy warnings on api
This commit is contained in:
committed by
Alex Auvolat
parent
4a1e079e8f
commit
84856e84e5
+5
-5
@@ -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(),
|
||||
))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user