refactor: apply clippy auto-fixes (162 warnings resolved)

- Fix needless borrows and references
- Collapse nested if statements
- Replace manual strip_prefix with str::strip_prefix()
- Remove redundant closures in map/unwrap_or_else
- Use Iterator::next_back() instead of rev().next()
- Simplify map_or patterns
- Use std::io::Error::other() instead of new(ErrorKind::Other, ..)
- Use div_ceil() instead of manual ceiling division
- Consolidate format! string arguments
- Various other idiomatic Rust improvements

39 files changed, 220 insertions(+), 320 deletions(-)
This commit is contained in:
Dionisio
2026-02-14 01:26:02 +01:00
parent 516b8727d2
commit 67137a3ef2
39 changed files with 220 additions and 320 deletions
@@ -24,10 +24,10 @@ use crate::domain::errors::{DomainError, ErrorKind};
#[macro_export]
macro_rules! impl_infra_error_to_domain {
($error_type:ty, $entity_type:expr) => {
impl From<$error_type> for crate::domain::errors::DomainError {
impl From<$error_type> for $crate::domain::errors::DomainError {
fn from(err: $error_type) -> Self {
crate::domain::errors::DomainError {
kind: crate::domain::errors::ErrorKind::InternalError,
$crate::domain::errors::DomainError {
kind: $crate::domain::errors::ErrorKind::InternalError,
entity_type: $entity_type,
entity_id: None,
message: format!("{}", err),
@@ -81,7 +81,7 @@ impl IntoDomainError for sqlx::Error {
}
sqlx::Error::Database(db_err) => {
// Handle specific PostgreSQL error codes
if db_err.code().map_or(false, |c| c == "23505") {
if db_err.code().is_some_and(|c| c == "23505") {
DomainError::already_exists(entity_type, "Record already exists")
} else {
DomainError::new(