From 1025f1bc0191b23febf8aa95dfe781b8dfb1879f Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Wed, 27 Aug 2025 21:45:49 -0300 Subject: [PATCH] feat: add thiserror and derive_more for error handling and boilerplate reduction Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- Cargo.toml | 1 + src/meta_plugin/digest.rs | 13 +------------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 572b321..e72f052 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ anyhow = "1.0.72" axum = "0.8.4" derive_more = "2.0" smart-default = "0.7" +thiserror = "1.0" base64 = "0.22.1" chrono = "0.4.26" clap = { version = "4.3.10", features = ["derive", "env"] } diff --git a/src/meta_plugin/digest.rs b/src/meta_plugin/digest.rs index b2eebbd..5bff1e1 100644 --- a/src/meta_plugin/digest.rs +++ b/src/meta_plugin/digest.rs @@ -4,24 +4,13 @@ use crate::meta_plugin::{MetaPlugin, MetaPluginType}; use std::fmt; use std::io::Write; -#[derive(Clone)] +#[derive(Clone, Debug)] enum Hasher { Md5(md5::Context), Sha256(Sha256), Sha512(Sha512), } -// Implement Debug manually since md5::Context doesn't implement it -impl fmt::Debug for Hasher { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Hasher::Md5(_) => write!(f, "Hasher::Md5"), - Hasher::Sha256(_) => write!(f, "Hasher::Sha256"), - Hasher::Sha512(_) => write!(f, "Hasher::Sha512"), - } - } -} - impl Hasher { fn update(&mut self, data: &[u8]) { match self {