diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-10 17:21:53 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-10 17:21:53 +0200 |
commit | c88d6e280a669eca44b8331b8731cf5fc933a957 (patch) | |
tree | f089a5402808a281a13be7b58593aaa829c8e109 /src/modules | |
parent | 6d0bac25aa3f118de34a9f05d939f60d80f550a5 (diff) | |
download | gnix-c88d6e280a669eca44b8331b8731cf5fc933a957.tar gnix-c88d6e280a669eca44b8331b8731cf5fc933a957.tar.bz2 gnix-c88d6e280a669eca44b8331b8731cf5fc933a957.tar.zst |
clippy
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/auth/mod.rs | 4 | ||||
-rw-r--r-- | src/modules/files.rs | 15 | ||||
-rw-r--r-- | src/modules/hosts.rs | 2 | ||||
-rw-r--r-- | src/modules/mod.rs | 2 |
4 files changed, 9 insertions, 14 deletions
diff --git a/src/modules/auth/mod.rs b/src/modules/auth/mod.rs index 715ca97..729ea42 100644 --- a/src/modules/auth/mod.rs +++ b/src/modules/auth/mod.rs @@ -64,9 +64,7 @@ impl<'de> Deserialize<'de> for Credentials { where A: MapAccess<'de>, { - Ok(HashMap::deserialize(value::MapAccessDeserializer::new( - val, - ))?) + HashMap::deserialize(value::MapAccessDeserializer::new(val)) } } let k = deserializer.deserialize_any(StringOrMap)?; diff --git a/src/modules/files.rs b/src/modules/files.rs index 4fdd5cd..607cee1 100644 --- a/src/modules/files.rs +++ b/src/modules/files.rs @@ -167,18 +167,15 @@ impl Node for Files { } else { Response::new(BoxBody::new(StreamBody::new( StreamBody::new(file_stream(file, 4096, range.clone())) - .map(|e| e.map(|e| Frame::data(e)).map_err(ServiceError::Io)), + .map(|e| e.map(Frame::data).map_err(ServiceError::Io)), ))) }; - if !skip_body { - if range.end - range.start != metadata.len() { - *r.status_mut() = StatusCode::PARTIAL_CONTENT; - r.headers_mut().typed_insert( - ContentRange::bytes(range.clone(), metadata.len()) - .expect("valid ContentRange"), - ); - } + if !skip_body && range.end - range.start != metadata.len() { + *r.status_mut() = StatusCode::PARTIAL_CONTENT; + r.headers_mut().typed_insert( + ContentRange::bytes(range.clone(), metadata.len()).expect("valid ContentRange"), + ); } // if not_modified || etag_matches { if not_modified { diff --git a/src/modules/hosts.rs b/src/modules/hosts.rs index 286d478..7ad7481 100644 --- a/src/modules/hosts.rs +++ b/src/modules/hosts.rs @@ -32,7 +32,7 @@ impl Node for Hosts { .and_then(|e| e.to_str().ok()) .ok_or(ServiceError::NoHost)?; - let host = remove_port(&host); + let host = remove_port(host); let node = self.0.get(host).ok_or(ServiceError::UnknownHost)?; node.handle(context, request).await diff --git a/src/modules/mod.rs b/src/modules/mod.rs index 2bee8e3..d96c24b 100644 --- a/src/modules/mod.rs +++ b/src/modules/mod.rs @@ -25,7 +25,7 @@ pub mod proxy; pub type NodeRequest = Request<Incoming>; pub type NodeResponse = Response<BoxBody<Bytes, ServiceError>>; -pub static MODULES: &'static [&'static dyn NodeKind] = &[ +pub static MODULES: &[&dyn NodeKind] = &[ &HttpBasicAuthKind, &CookieAuthKind, &ProxyKind, |