Skip to content

Commit

Permalink
refactor: fix rust edition idioms
Browse files Browse the repository at this point in the history
  • Loading branch information
joseluisq committed Sep 27, 2021
1 parent 34efa49 commit 6f7a6bc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/bin/server.rs
Original file line number Diff line number Diff line change
@@ -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()?;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![deny(warnings)]
#![deny(rust_2018_idioms)]

#[macro_use]
extern crate anyhow;
Expand Down
4 changes: 2 additions & 2 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(()))
}

Expand All @@ -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(()))
}

Expand Down
6 changes: 3 additions & 3 deletions src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6f7a6bc

Please sign in to comment.