aboutsummaryrefslogtreecommitdiff
path: root/src/api/helpers.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-02-07 14:53:13 +0100
committerAlex Auvolat <alex@adnab.me>2024-02-07 14:53:13 +0100
commit53746b59e525ff5f518ed59d7831b05e2732785d (patch)
tree605816d809673c17d0443815fef3bb412cdd9522 /src/api/helpers.rs
parenta31d1bd4969654e6041070b6e80ae025925808c2 (diff)
downloadgarage-53746b59e525ff5f518ed59d7831b05e2732785d.tar.gz
garage-53746b59e525ff5f518ed59d7831b05e2732785d.zip
[dep-upgrade-202402] slightly more explicit error management
Diffstat (limited to 'src/api/helpers.rs')
-rw-r--r--src/api/helpers.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/api/helpers.rs b/src/api/helpers.rs
index 66f4c465..ba7b1599 100644
--- a/src/api/helpers.rs
+++ b/src/api/helpers.rs
@@ -1,3 +1,5 @@
+use std::convert::Infallible;
+
use http_body_util::{BodyExt, Full as FullBody};
use hyper::{body::Body, Request, Response};
use idna::domain_to_unicode;
@@ -151,10 +153,10 @@ pub fn string_body<E>(s: String) -> BoxBody<E> {
bytes_body(bytes::Bytes::from(s.into_bytes()))
}
pub fn bytes_body<E>(b: bytes::Bytes) -> BoxBody<E> {
- BoxBody::new(FullBody::new(b).map_err(|_| unreachable!()))
+ BoxBody::new(FullBody::new(b).map_err(|_: Infallible| unreachable!()))
}
pub fn empty_body<E>() -> BoxBody<E> {
- BoxBody::new(http_body_util::Empty::new().map_err(|_| unreachable!()))
+ BoxBody::new(http_body_util::Empty::new().map_err(|_: Infallible| unreachable!()))
}
pub fn error_body(s: String) -> ErrorBody {
ErrorBody::from(bytes::Bytes::from(s.into_bytes()))