From 764f9401ac3003886f487a4de9f5ff2fb2220e02 Mon Sep 17 00:00:00 2001 From: Lennart <18233294+lennart-k@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:15:44 +0100 Subject: [PATCH] dav: remove anyhow dependency --- Cargo.lock | 1 - crates/dav/Cargo.toml | 1 - crates/dav/src/error.rs | 4 ---- crates/dav/src/resource.rs | 4 ++-- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6ea4004..31448de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2590,7 +2590,6 @@ name = "rustical_dav" version = "0.1.0" dependencies = [ "actix-web", - "anyhow", "async-trait", "derive_more 1.0.0", "futures-util", diff --git a/crates/dav/Cargo.toml b/crates/dav/Cargo.toml index ffb0d35..1e4181c 100644 --- a/crates/dav/Cargo.toml +++ b/crates/dav/Cargo.toml @@ -8,7 +8,6 @@ publish = false [dependencies] actix-web = { workspace = true } -anyhow = { workspace = true } async-trait = { workspace = true } futures-util = { workspace = true } quick-xml = { workspace = true } diff --git a/crates/dav/src/error.rs b/crates/dav/src/error.rs index a183cb5..98ef614 100644 --- a/crates/dav/src/error.rs +++ b/crates/dav/src/error.rs @@ -25,16 +25,12 @@ pub enum Error { #[error(transparent)] XmlSerializationError(#[from] quick_xml::SeError), - - #[error("Internal server error")] - Other(#[from] anyhow::Error), } impl actix_web::error::ResponseError for Error { fn status_code(&self) -> StatusCode { match self { Self::InternalError => StatusCode::INTERNAL_SERVER_ERROR, - Self::Other(_) => StatusCode::INTERNAL_SERVER_ERROR, Self::NotFound => StatusCode::NOT_FOUND, Self::BadRequest(_) => StatusCode::BAD_REQUEST, Self::Unauthorized => StatusCode::UNAUTHORIZED, diff --git a/crates/dav/src/resource.rs b/crates/dav/src/resource.rs index 86da0ec..d3413b4 100644 --- a/crates/dav/src/resource.rs +++ b/crates/dav/src/resource.rs @@ -18,7 +18,7 @@ use strum::VariantNames; pub trait Resource: Clone { type PropName: FromStr + VariantNames + Clone; type Prop: Serialize + for<'de> Deserialize<'de> + fmt::Debug + InvalidProperty; - type Error: ResponseError + From + From; + type Error: ResponseError + From; fn list_props() -> &'static [&'static str] { Self::PropName::VARIANTS @@ -139,7 +139,7 @@ pub trait ResourceService: Sized + 'static { type MemberType: Resource; type PathComponents: for<'de> Deserialize<'de> + Sized + Clone + 'static; // defines how the resource URI maps to parameters, i.e. /{principal}/{calendar} -> (String, String) type Resource: Resource; - type Error: ResponseError + From + From; + type Error: ResponseError + From; async fn new( req: &HttpRequest,