diff --git a/src/actix_web/http_compat.rs b/src/actix_web/http_compat.rs index 099664c..b605444 100644 --- a/src/actix_web/http_compat.rs +++ b/src/actix_web/http_compat.rs @@ -1,9 +1,9 @@ -#![allow(clippy::unwrap_used)] +//! Remove these conversion helpers after actix-web upgrades to http 1.0 use std::str::FromStr; pub fn header_value(v: &http02::HeaderValue) -> http::HeaderValue { - http::HeaderValue::from_bytes(v.as_bytes()).unwrap() + http::HeaderValue::from_bytes(v.as_bytes()).expect("can convert http types") } pub fn header_map<'a, H>(m: H) -> http::HeaderMap @@ -13,7 +13,8 @@ where let mut new_map = http::HeaderMap::new(); for (n, v) in m { new_map.insert( - http::HeaderName::from_lowercase(n.as_str().as_bytes()).unwrap(), + http::HeaderName::from_lowercase(n.as_str().as_bytes()) + .expect("can convert http types"), header_value(v), ); } @@ -21,9 +22,9 @@ where } pub fn method(m: &http02::Method) -> http::Method { - http::Method::from_bytes(m.as_str().as_bytes()).unwrap() + http::Method::from_bytes(m.as_str().as_bytes()).expect("can convert http types") } pub fn uri(m: &http02::Uri) -> http::Uri { - http::Uri::from_str(&m.to_string()).unwrap() + http::Uri::from_str(&m.to_string()).expect("can convert http types") } diff --git a/src/actix_web/inbox.rs b/src/actix_web/inbox.rs index 111e186..9bce475 100644 --- a/src/actix_web/inbox.rs +++ b/src/actix_web/inbox.rs @@ -64,6 +64,7 @@ mod test { use serde_json::json; use url::Url; + /// Remove this conversion helper after actix-web upgrades to http 1.0 fn header_pair( p: (&http::HeaderName, &http::HeaderValue), ) -> (http02::HeaderName, http02::HeaderValue) {