From c3601b8d0468993346fed760d48593db7a47b851 Mon Sep 17 00:00:00 2001 From: JyJyJcr <82190170+JyJyJcr@users.noreply.github.com> Date: Fri, 27 Dec 2024 07:37:02 +0900 Subject: [PATCH] fix: support old stable Error trait --- src/http/module.rs | 3 ++- src/http/request.rs | 4 ++-- src/http/status.rs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/http/module.rs b/src/http/module.rs index fbe9e11..5ba9b1c 100644 --- a/src/http/module.rs +++ b/src/http/module.rs @@ -12,7 +12,8 @@ pub enum MergeConfigError { NoValue, } -impl core::error::Error for MergeConfigError {} +#[cfg(feature = "std")] +impl std::error::Error for MergeConfigError {} impl core::fmt::Display for MergeConfigError { fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { diff --git a/src/http/request.rs b/src/http/request.rs index eb74edb..1ddfb24 100644 --- a/src/http/request.rs +++ b/src/http/request.rs @@ -1,4 +1,3 @@ -use core::error::Error; use core::ffi::c_void; use core::fmt; use core::marker::PhantomData; @@ -718,7 +717,8 @@ impl fmt::Display for InvalidMethod { } } -impl Error for InvalidMethod {} +#[cfg(feature = "std")] +impl std::error::Error for InvalidMethod {} #[derive(Clone, PartialEq, Eq, Hash)] enum MethodInner { diff --git a/src/http/status.rs b/src/http/status.rs index b067a93..ec77a92 100644 --- a/src/http/status.rs +++ b/src/http/status.rs @@ -1,4 +1,3 @@ -use core::error::Error; use core::fmt; use crate::core::Status; @@ -29,7 +28,8 @@ impl fmt::Display for InvalidHTTPStatusCode { } } -impl Error for InvalidHTTPStatusCode {} +#[cfg(feature = "std")] +impl std::error::Error for InvalidHTTPStatusCode {} impl From for Status { fn from(val: HTTPStatus) -> Self {