1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 17:07:01 +02:00

clippy warnings; fmt

This commit is contained in:
Nikolay Kim
2018-04-28 22:55:47 -07:00
parent a38c3985f6
commit de49796fd1
67 changed files with 988 additions and 1866 deletions

View File

@@ -53,8 +53,8 @@ impl<'a> ConnectionInfo<'a> {
// scheme
if scheme.is_none() {
if let Some(h) = req.headers()
.get(HeaderName::from_str(X_FORWARDED_PROTO).unwrap())
if let Some(h) =
req.headers().get(HeaderName::from_str(X_FORWARDED_PROTO).unwrap())
{
if let Ok(h) = h.to_str() {
scheme = h.split(',').next().map(|v| v.trim());
@@ -74,8 +74,8 @@ impl<'a> ConnectionInfo<'a> {
// host
if host.is_none() {
if let Some(h) = req.headers()
.get(HeaderName::from_str(X_FORWARDED_HOST).unwrap())
if let Some(h) =
req.headers().get(HeaderName::from_str(X_FORWARDED_HOST).unwrap())
{
if let Ok(h) = h.to_str() {
host = h.split(',').next().map(|v| v.trim());
@@ -98,8 +98,8 @@ impl<'a> ConnectionInfo<'a> {
// remote addr
if remote.is_none() {
if let Some(h) = req.headers()
.get(HeaderName::from_str(X_FORWARDED_FOR).unwrap())
if let Some(h) =
req.headers().get(HeaderName::from_str(X_FORWARDED_FOR).unwrap())
{
if let Ok(h) = h.to_str() {
remote = h.split(',').next().map(|v| v.trim());
@@ -189,10 +189,8 @@ mod tests {
assert_eq!(info.remote(), Some("192.0.2.60"));
let mut req = HttpRequest::default();
req.headers_mut().insert(
header::HOST,
HeaderValue::from_static("rust-lang.org"),
);
req.headers_mut()
.insert(header::HOST, HeaderValue::from_static("rust-lang.org"));
let info = ConnectionInfo::new(&req);
assert_eq!(info.scheme(), "http");