summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-06-11 15:27:09 +0200
committerYorhel <git@yorhel.nl>2020-06-11 15:27:09 +0200
commit4e706249c0a76f5016c36632522569ad9d9e66ed (patch)
treeb54dde8e783cdcabb1a16343af17a3ce3277854e
parent30911eec765dcb219fb1600cd10da27372c09ed1 (diff)
More clippy things
-rw-r--r--src/blake3.rs2
-rw-r--r--src/httpserv.rs10
-rw-r--r--src/lib.rs2
-rw-r--r--src/util.rs2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/blake3.rs b/src/blake3.rs
index d3f202b..84bff88 100644
--- a/src/blake3.rs
+++ b/src/blake3.rs
@@ -57,7 +57,7 @@ impl std::str::FromStr for Hash {
let mut h = Hash([0u8;OUT_LEN]);
for (i,c) in s.as_bytes().chunks_exact(2).enumerate() {
match (hexdigit(c[0]), hexdigit(c[1])) {
- (Some(a), Some(b)) => h.0[i] = a << 4 + b,
+ (Some(a), Some(b)) => h.0[i] = (a << 4) + b,
_ => return Err(HashParseError(()))
}
}
diff --git a/src/httpserv.rs b/src/httpserv.rs
index 3c779cd..19663b2 100644
--- a/src/httpserv.rs
+++ b/src/httpserv.rs
@@ -1,3 +1,4 @@
+#![allow(clippy::redundant_field_names)]
use std::net::Shutdown;
use std::io::{self,Read,Write,Seek,SeekFrom};
use std::fs::File;
@@ -9,7 +10,6 @@ use std::sync::atomic::{AtomicBool,AtomicUsize,Ordering::{Relaxed,SeqCst}};
use std::collections::{HashMap,VecDeque};
use chrono::prelude::*;
use multisock::{Listener,Stream,SocketAddr};
-use httparse;
use crate::util::{VecFill,percent_escape,hexdigit};
@@ -192,10 +192,10 @@ impl<'a> Request<'a> {
req.range = Self::parse_range(h.value);
} else if h.name.eq_ignore_ascii_case("accept-encoding") {
- if h.value.windows(4).find(|s| s == b"gzip").is_some() {
+ if h.value.windows(4).any(|s| s == b"gzip") {
req.can_gzip = true;
}
- if h.value.windows(4).find(|s| s == b"zstd").is_some() {
+ if h.value.windows(4).any(|s| s == b"zstd") {
req.can_zstd = true;
}
@@ -680,14 +680,14 @@ impl Connection {
}
fn run(&self) -> io::Result<()> {
- while let Some(mut req) = self.read_request()? {
+ while let Some(req) = self.read_request()? {
let receive_ts = Instant::now();
self.work_start();
if !self.alive.load(SeqCst) {
break;
}
- let res = self.handle_req(&mut req, receive_ts);
+ let res = self.handle_req(&req, receive_ts);
self.work_end();
res?;
}
diff --git a/src/lib.rs b/src/lib.rs
index bc23692..7d6e4e7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,4 @@
-#![allow(clippy::or_fun_call, clippy::identity_op, clippy::redundant_field_names)]
+#![allow(clippy::or_fun_call, clippy::redundant_field_names, clippy::len_without_is_empty)]
#[cfg(feature="postgres")] #[macro_use] extern crate postgres_types;
#[macro_use] extern crate log;
diff --git a/src/util.rs b/src/util.rs
index 3519830..c1b11f1 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -97,7 +97,7 @@ pub fn percent_escape(s: &str, out: &mut Vec<u8>) {
_ => {
out.push(b'%');
out.push(HEXCHARS[((c >> 4) & 0x0F) as usize]);
- out.push(HEXCHARS[((c >> 0) & 0x0F) as usize]);
+ out.push(HEXCHARS[( c & 0x0F) as usize]);
},
}
}