chore: address Rust 1.78 clippy lints (#4545)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Chethan Rao
2024-05-07 16:05:32 +05:30
committed by GitHub
parent 99bbc3982f
commit 2216a88d25
222 changed files with 1138 additions and 1631 deletions

View File

@ -8,7 +8,7 @@ use hyperswitch_domain_models::errors::StorageError as DataStorageError;
pub use redis_interface::errors::RedisError;
use router_env::opentelemetry::metrics::MetricsError;
use crate::{errors as storage_errors, store::errors::DatabaseError};
use crate::store::errors::DatabaseError;
pub type ApplicationResult<T> = Result<T, ApplicationError>;
@ -56,20 +56,16 @@ impl Into<DataStorageError> for &StorageError {
fn into(self) -> DataStorageError {
match self {
StorageError::DatabaseError(i) => match i.current_context() {
storage_errors::DatabaseError::DatabaseConnectionError => {
DataStorageError::DatabaseConnectionError
}
DatabaseError::DatabaseConnectionError => DataStorageError::DatabaseConnectionError,
// TODO: Update this error type to encompass & propagate the missing type (instead of generic `db value not found`)
storage_errors::DatabaseError::NotFound => {
DatabaseError::NotFound => {
DataStorageError::ValueNotFound(String::from("db value not found"))
}
// TODO: Update this error type to encompass & propagate the duplicate type (instead of generic `db value not found`)
storage_errors::DatabaseError::UniqueViolation => {
DataStorageError::DuplicateValue {
entity: "db entity",
key: None,
}
}
DatabaseError::UniqueViolation => DataStorageError::DuplicateValue {
entity: "db entity",
key: None,
},
err => DataStorageError::DatabaseError(error_stack::report!(*err)),
},
StorageError::ValueNotFound(i) => DataStorageError::ValueNotFound(i.clone()),