From 81d72954867d01e5f977883a8f8ee6b27771c875 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 1 Nov 2021 23:41:28 +0000 Subject: [PATCH] clippy --- actix-server/src/builder.rs | 22 ++++++++++------------ actix-tls/examples/tcp-rustls.rs | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index ca3a71f3..7e3df9d8 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -446,29 +446,27 @@ pub(super) fn bind_addr( backlog: u32, ) -> io::Result> { let mut err = None; - let mut succ = false; + let mut success = false; let mut sockets = Vec::new(); for addr in addr.to_socket_addrs()? { match create_tcp_listener(addr, backlog) { Ok(lst) => { - succ = true; + success = true; sockets.push(lst); } Err(e) => err = Some(e), } } - if !succ { - if let Some(e) = err.take() { - Err(e) - } else { - Err(io::Error::new( - io::ErrorKind::Other, - "Can not bind to address.", - )) - } - } else { + if success { Ok(sockets) + } else if let Some(err) = err.take() { + Err(err) + } else { + Err(io::Error::new( + io::ErrorKind::Other, + "Can not bind to address.", + )) } } diff --git a/actix-tls/examples/tcp-rustls.rs b/actix-tls/examples/tcp-rustls.rs index 03f58531..f347e164 100644 --- a/actix-tls/examples/tcp-rustls.rs +++ b/actix-tls/examples/tcp-rustls.rs @@ -30,7 +30,7 @@ use std::{ }; use actix_rt::net::TcpStream; -use actix_server::{Server, ServerHandle}; +use actix_server::Server; use actix_service::ServiceFactoryExt as _; use actix_tls::accept::rustls::{Acceptor as RustlsAcceptor, TlsStream}; use futures_util::future::ok;