From 941f67dec9b82c1a7bb1b77dc174ef921022da62 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 21:46:17 +0000 Subject: [PATCH] s/e/err --- actix-codec/src/framed.rs | 6 +++--- actix-codec/tests/test_framed_sink.rs | 10 +++++----- actix-rt/examples/hyper.rs | 4 ++-- actix-server/src/accept.rs | 20 ++++++++++---------- actix-server/src/builder.rs | 8 ++++---- actix-server/src/service.rs | 4 ++-- actix-service/src/map.rs | 2 +- actix-tls/src/connect/openssl.rs | 9 ++++++--- actix-tls/src/connect/resolver.rs | 4 ++-- 9 files changed, 35 insertions(+), 32 deletions(-) diff --git a/actix-codec/src/framed.rs b/actix-codec/src/framed.rs index 997487c2..73dca006 100644 --- a/actix-codec/src/framed.rs +++ b/actix-codec/src/framed.rs @@ -193,7 +193,7 @@ impl Framed { match this.codec.decode_eof(this.read_buf) { Ok(Some(frame)) => return Poll::Ready(Some(Ok(frame))), Ok(None) => return Poll::Ready(None), - Err(e) => return Poll::Ready(Some(Err(e))), + Err(err) => return Poll::Ready(Some(Err(err))), } } @@ -204,7 +204,7 @@ impl Framed { log::trace!("frame decoded from buffer"); return Poll::Ready(Some(Ok(frame))); } - Err(e) => return Poll::Ready(Some(Err(e))), + Err(err) => return Poll::Ready(Some(Err(err))), _ => (), // Need more data } @@ -221,7 +221,7 @@ impl Framed { let cnt = match tokio_util::io::poll_read_buf(this.io, cx, this.read_buf) { Poll::Pending => return Poll::Pending, - Poll::Ready(Err(e)) => return Poll::Ready(Some(Err(e.into()))), + Poll::Ready(Err(err)) => return Poll::Ready(Some(Err(err.into()))), Poll::Ready(Ok(cnt)) => cnt, }; diff --git a/actix-codec/tests/test_framed_sink.rs b/actix-codec/tests/test_framed_sink.rs index aca4760d..15c3c292 100644 --- a/actix-codec/tests/test_framed_sink.rs +++ b/actix-codec/tests/test_framed_sink.rs @@ -50,7 +50,7 @@ impl Write for Bilateral { assert_eq!(&data[..], &src[..data.len()]); Ok(data.len()) } - Some(Err(e)) => Err(e), + Some(Err(err)) => Err(err), None => panic!("unexpected write; {:?}", src), } } @@ -67,13 +67,13 @@ impl AsyncWrite for Bilateral { buf: &[u8], ) -> Poll> { match Pin::get_mut(self).write(buf) { - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => Pending, + Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => Pending, other => Ready(other), } } fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { match Pin::get_mut(self).flush() { - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => Pending, + Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => Pending, other => Ready(other), } } @@ -99,8 +99,8 @@ impl AsyncRead for Bilateral { buf.put_slice(&data); Ready(Ok(())) } - Some(Err(ref e)) if e.kind() == WouldBlock => Pending, - Some(Err(e)) => Ready(Err(e)), + Some(Err(ref err)) if err.kind() == WouldBlock => Pending, + Some(Err(err)) => Ready(Err(err)), None => Ready(Ok(())), } } diff --git a/actix-rt/examples/hyper.rs b/actix-rt/examples/hyper.rs index 8bad1b33..3520acd0 100644 --- a/actix-rt/examples/hyper.rs +++ b/actix-rt/examples/hyper.rs @@ -21,8 +21,8 @@ fn main() { let server = Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))).serve(make_service); - if let Err(e) = server.await { - eprintln!("server error: {}", e); + if let Err(err) = server.await { + eprintln!("server error: {}", err); } }) } diff --git a/actix-server/src/accept.rs b/actix-server/src/accept.rs index cd37460b..9f7872f8 100644 --- a/actix-server/src/accept.rs +++ b/actix-server/src/accept.rs @@ -127,10 +127,10 @@ impl Accept { let mut events = mio::Events::with_capacity(256); loop { - if let Err(e) = self.poll.poll(&mut events, self.timeout) { - match e.kind() { + if let Err(err) = self.poll.poll(&mut events, self.timeout) { + match err.kind() { io::ErrorKind::Interrupted => {} - _ => panic!("Poll error: {}", e), + _ => panic!("Poll error: {}", err), } } @@ -298,15 +298,15 @@ impl Accept { fn register_logged(&self, info: &mut ServerSocketInfo) { match self.register(info) { Ok(_) => debug!("Resume accepting connections on {}", info.lst.local_addr()), - Err(e) => error!("Can not register server socket {}", e), + Err(err) => error!("Can not register server socket {}", err), } } fn deregister_logged(&self, info: &mut ServerSocketInfo) { match self.poll.registry().deregister(&mut info.lst) { Ok(_) => debug!("Paused accepting connections on {}", info.lst.local_addr()), - Err(e) => { - error!("Can not deregister server socket {}", e) + Err(err) => { + error!("Can not deregister server socket {}", err) } } } @@ -396,10 +396,10 @@ impl Accept { let conn = Conn { io, token }; self.accept_one(conn); } - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => return, - Err(ref e) if connection_error(e) => continue, - Err(e) => { - error!("Error accepting connection: {}", e); + Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => return, + Err(ref err) if connection_error(err) => continue, + Err(err) => { + error!("Error accepting connection: {}", err); // deregister listener temporary self.deregister_logged(info); diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index 805c6e75..ad41d056 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -220,10 +220,10 @@ impl ServerBuilder { { // The path must not exist when we try to bind. // Try to remove it to avoid bind error. - if let Err(e) = std::fs::remove_file(addr.as_ref()) { + if let Err(err) = std::fs::remove_file(addr.as_ref()) { // NotFound is expected and not an issue. Anything else is. - if e.kind() != std::io::ErrorKind::NotFound { - return Err(e); + if err.kind() != std::io::ErrorKind::NotFound { + return Err(err); } } @@ -273,7 +273,7 @@ pub(super) fn bind_addr( success = true; sockets.push(lst); } - Err(e) => err = Some(e), + Err(err) => err = Some(err), } } diff --git a/actix-server/src/service.rs b/actix-server/src/service.rs index 24d2450c..3a9aeee4 100644 --- a/actix-server/src/service.rs +++ b/actix-server/src/service.rs @@ -77,8 +77,8 @@ where }); Ok(()) } - Err(e) => { - error!("Can not convert to an async tcp stream: {}", e); + Err(err) => { + error!("Can not convert to an async tcp stream: {}", err); Err(()) } }) diff --git a/actix-service/src/map.rs b/actix-service/src/map.rs index 985a5433..49ddd9fe 100644 --- a/actix-service/src/map.rs +++ b/actix-service/src/map.rs @@ -97,7 +97,7 @@ where match this.fut.poll(cx) { Poll::Ready(Ok(resp)) => Poll::Ready(Ok((this.f)(resp))), - Poll::Ready(Err(e)) => Poll::Ready(Err(e)), + Poll::Ready(Err(err)) => Poll::Ready(Err(err)), Poll::Pending => Poll::Pending, } } diff --git a/actix-tls/src/connect/openssl.rs b/actix-tls/src/connect/openssl.rs index a6e40ae1..5739f6bc 100644 --- a/actix-tls/src/connect/openssl.rs +++ b/actix-tls/src/connect/openssl.rs @@ -141,9 +141,12 @@ where trace!("SSL Handshake success: {:?}", stream.hostname()); Poll::Ready(Ok(stream.replace_io(this.io.take().unwrap()).1)) } - Err(e) => { - trace!("SSL Handshake error: {:?}", e); - Poll::Ready(Err(io::Error::new(io::ErrorKind::Other, format!("{}", e)))) + Err(err) => { + trace!("SSL Handshake error: {:?}", err); + Poll::Ready(Err(io::Error::new( + io::ErrorKind::Other, + format!("{}", err), + ))) } } } diff --git a/actix-tls/src/connect/resolver.rs b/actix-tls/src/connect/resolver.rs index 8e700deb..245f919c 100644 --- a/actix-tls/src/connect/resolver.rs +++ b/actix-tls/src/connect/resolver.rs @@ -164,8 +164,8 @@ impl Future for ResolverFut { Self::LookUp(fut, req) => { let res = match ready!(Pin::new(fut).poll(cx)) { Ok(Ok(res)) => Ok(res), - Ok(Err(e)) => Err(ConnectError::Resolver(Box::new(e))), - Err(e) => Err(ConnectError::Io(e.into())), + Ok(Err(err)) => Err(ConnectError::Resolver(Box::new(err))), + Err(err) => Err(ConnectError::Io(err.into())), }; let req = req.take().unwrap();