refactor: fix rust edition idioms
Diff
src/bin/server.rs | 5 ++---
src/lib.rs | 1 +
src/service.rs | 4 ++--
src/tls.rs | 6 +++---
4 files changed, 8 insertions(+), 8 deletions(-)
@@ -1,12 +1,11 @@
#![deny(warnings)]
#![deny(rust_2018_idioms)]
#[cfg(all(target_env = "musl", target_pointer_width = "64"))]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
extern crate static_web_server;
use self::static_web_server::{Result, Server};
use static_web_server::{Result, Server};
fn main() -> Result {
Server::new().run()?;
@@ -1,4 +1,5 @@
#![deny(warnings)]
#![deny(rust_2018_idioms)]
#[macro_use]
extern crate anyhow;
@@ -26,7 +26,7 @@ impl<T> Service<T> for RouterService {
type Error = Infallible;
type Future = Ready<Result<Self::Response, Self::Error>>;
fn poll_ready(&mut self, _: &mut Context) -> Poll<Result<(), Self::Error>> {
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
@@ -45,7 +45,7 @@ impl Service<Request<Body>> for RequestService {
type Error = Error;
type Future = Pin<Box<dyn Future<Output = Result<Response<Body>, Error>> + Send + 'static>>;
fn poll_ready(&mut self, _: &mut Context) -> Poll<Result<(), Error>> {
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Error>> {
Poll::Ready(Ok(()))
}
@@ -71,7 +71,7 @@ pub struct TlsConfigBuilder {
}
impl std::fmt::Debug for TlsConfigBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.debug_struct("TlsConfigBuilder").finish()
}
}
@@ -303,8 +303,8 @@ impl TlsStream {
impl AsyncRead for TlsStream {
fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut ReadBuf,
cx: &mut Context<'_>,
buf: &mut ReadBuf<'_>,
) -> Poll<io::Result<()>> {
let pin = self.get_mut();
match pin.state {