style(lib): address most clippy lints

This commit is contained in:
danieleades
2020-01-03 17:40:32 +00:00
committed by Sean McArthur
parent 0f13719873
commit 0eaf304644
29 changed files with 162 additions and 200 deletions

View File

@@ -292,7 +292,7 @@ impl Opts {
} else {
self.request_body
.map(Body::from)
.unwrap_or_else(|| Body::empty())
.unwrap_or_else(Body::empty)
};
let mut req = Request::new(body);
*req.method_mut() = self.request_method.clone();
@@ -355,5 +355,5 @@ fn spawn_server(rt: &mut tokio::runtime::Runtime, opts: &Opts) -> SocketAddr {
panic!("server error: {}", err);
}
});
return addr;
addr
}

View File

@@ -105,7 +105,7 @@ fn throughput_fixedsize_large_payload(b: &mut test::Bencher) {
#[bench]
fn throughput_fixedsize_many_chunks(b: &mut test::Bencher) {
bench_server!(b, ("content-length", "1000000"), || {
static S: &'static [&'static [u8]] = &[&[b'x'; 1_000] as &[u8]; 1_000] as _;
static S: &[&[u8]] = &[&[b'x'; 1_000] as &[u8]; 1_000] as _;
Body::wrap_stream(stream::iter(S.iter()).map(|&s| Ok::<_, String>(s)))
})
}
@@ -127,7 +127,7 @@ fn throughput_chunked_large_payload(b: &mut test::Bencher) {
#[bench]
fn throughput_chunked_many_chunks(b: &mut test::Bencher) {
bench_server!(b, ("transfer-encoding", "chunked"), || {
static S: &'static [&'static [u8]] = &[&[b'x'; 1_000] as &[u8]; 1_000] as _;
static S: &[&[u8]] = &[&[b'x'; 1_000] as &[u8]; 1_000] as _;
Body::wrap_stream(stream::iter(S.iter()).map(|&s| Ok::<_, String>(s)))
})
}