Skip to content

Commit

Permalink
fix(server): drop dead code
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
  • Loading branch information
elmarco authored and CBenoit committed Nov 26, 2024
1 parent 812ba3a commit e96be9c
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions picky-server/src/http/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ pub trait StatusCodeResult<T> {
fn bad_request_desc(self, desc: &str) -> Result<T, StatusCode>;

fn not_found(self) -> Result<T, StatusCode>;
fn not_found_desc(self, desc: &str) -> Result<T, StatusCode>;

fn internal_error(self) -> Result<T, StatusCode>;
fn internal_error_desc(self, desc: &str) -> Result<T, StatusCode>;

fn service_unavailable(self) -> Result<T, StatusCode>;
fn service_unavailable_desc(self, desc: &str) -> Result<T, StatusCode>;

fn unauthorized(self) -> Result<T, StatusCode>;
fn unauthorized_desc(self, desc: &str) -> Result<T, StatusCode>;
}

macro_rules! status_code_on_error {
Expand Down Expand Up @@ -55,10 +50,6 @@ impl<T, E: fmt::Display> StatusCodeResult<T> for Result<T, E> {
status_code_on_error!(self, NOT_FOUND)
}

fn not_found_desc(self, desc: &str) -> Result<T, StatusCode> {
status_code_on_error!(self, NOT_FOUND, desc)
}

fn internal_error(self) -> Result<T, StatusCode> {
status_code_on_error!(self, INTERNAL_SERVER_ERROR)
}
Expand All @@ -70,18 +61,6 @@ impl<T, E: fmt::Display> StatusCodeResult<T> for Result<T, E> {
fn service_unavailable(self) -> Result<T, StatusCode> {
status_code_on_error!(self, SERVICE_UNAVAILABLE)
}

fn service_unavailable_desc(self, desc: &str) -> Result<T, StatusCode> {
status_code_on_error!(self, SERVICE_UNAVAILABLE, desc)
}

fn unauthorized(self) -> Result<T, StatusCode> {
status_code_on_error!(self, UNAUTHORIZED)
}

fn unauthorized_desc(self, desc: &str) -> Result<T, StatusCode> {
status_code_on_error!(self, UNAUTHORIZED, desc)
}
}

macro_rules! status_code_on_none {
Expand Down Expand Up @@ -112,10 +91,6 @@ impl<T> StatusCodeResult<T> for Option<T> {
status_code_on_none!(self, NOT_FOUND)
}

fn not_found_desc(self, desc: &str) -> Result<T, StatusCode> {
status_code_on_none!(self, NOT_FOUND, desc)
}

fn internal_error(self) -> Result<T, StatusCode> {
status_code_on_none!(self, INTERNAL_SERVER_ERROR)
}
Expand All @@ -127,18 +102,6 @@ impl<T> StatusCodeResult<T> for Option<T> {
fn service_unavailable(self) -> Result<T, StatusCode> {
status_code_on_none!(self, SERVICE_UNAVAILABLE)
}

fn service_unavailable_desc(self, desc: &str) -> Result<T, StatusCode> {
status_code_on_none!(self, SERVICE_UNAVAILABLE, desc)
}

fn unauthorized(self) -> Result<T, StatusCode> {
status_code_on_none!(self, UNAUTHORIZED)
}

fn unauthorized_desc(self, desc: &str) -> Result<T, StatusCode> {
status_code_on_none!(self, UNAUTHORIZED, desc)
}
}

// === saphir request extension === //
Expand Down

0 comments on commit e96be9c

Please sign in to comment.