diff --git a/abci/src/server.rs b/abci/src/server.rs index 9b33151b..630379a0 100644 --- a/abci/src/server.rs +++ b/abci/src/server.rs @@ -115,7 +115,7 @@ impl<'a, App: RequestDispatcher + 'a> ServerBuilder { let _guard = server_runtime.handle.enter(); // No cancel is defined, so we add some "mock" - let cancel = self.cancel.unwrap_or(CancellationToken::new()); + let cancel = self.cancel.unwrap_or_default(); let server = match bind_address.scheme() { #[cfg(feature = "tcp")] diff --git a/abci/src/server/codec.rs b/abci/src/server/codec.rs index 1da927a7..8d531e33 100644 --- a/abci/src/server/codec.rs +++ b/abci/src/server/codec.rs @@ -230,12 +230,12 @@ mod test { let codec = tokio_util::codec::Framed::new(server, super::Coder {}); let worker_cancel = cancel.clone(); - let hdl = tokio::spawn( - async move { - super::Codec::process_worker_queues(codec, request_tx, response_rx, worker_cancel) - } - .await, - ); + let hdl = tokio::spawn(super::Codec::process_worker_queues( + codec, + request_tx, + response_rx, + worker_cancel, + )); // We send 2 requests over the wire for n_requests in 0..5 { diff --git a/abci/tests/common/docker.rs b/abci/tests/common/docker.rs index 61cc9216..5e1e5001 100644 --- a/abci/tests/common/docker.rs +++ b/abci/tests/common/docker.rs @@ -153,14 +153,14 @@ impl TenderdashDocker { None }; - let app_address = app_address.to_string().replace("/", "\\/"); + let app_address = app_address.to_string().replace('/', "\\/"); debug!("Tenderdash will connect to ABCI address: {}", app_address); let container_config = Config { image: Some(self.image.clone()), env: Some(vec![format!("PROXY_APP={}", app_address)]), host_config: Some(HostConfig { - binds: binds, + binds, ..Default::default() }), ..Default::default() @@ -215,7 +215,7 @@ impl TenderdashDocker { let mut dest = tokio::io::BufWriter::new(stderror); let mut logs = docker.logs( - &id, + id, Some(bollard::container::LogsOptions { follow: false, stdout: true, @@ -269,6 +269,8 @@ impl Drop for TenderdashDocker { pub fn setup_td_logs_panic(td_docker: &Arc) { let weak_ref = Arc::downgrade(td_docker); std::panic::set_hook(Box::new(move |_| { - weak_ref.upgrade().map(|td| td.print_logs()); + if let Some(td) = weak_ref.upgrade() { + td.print_logs() + } })); } diff --git a/abci/tests/kvstore.rs b/abci/tests/kvstore.rs index aec9fa89..a243363f 100644 --- a/abci/tests/kvstore.rs +++ b/abci/tests/kvstore.rs @@ -2,7 +2,6 @@ mod common; use std::{ collections::{BTreeMap, BTreeSet}, - mem, ops::Deref, sync::{RwLock, RwLockWriteGuard}, }; @@ -95,7 +94,7 @@ impl KVStore { } pub(crate) fn commit(&mut self) { - let pending_operations = mem::replace(&mut self.pending_operations, BTreeSet::new()); + let pending_operations = std::mem::take(&mut self.pending_operations); pending_operations .into_iter() .for_each(|op| op.apply(&mut self.persisted_state)); diff --git a/abci/tests/tcp.rs b/abci/tests/tcp.rs index 80b95dd6..8b439768 100644 --- a/abci/tests/tcp.rs +++ b/abci/tests/tcp.rs @@ -14,7 +14,7 @@ use tenderdash_abci::proto; fn test_ipv4_server() { // we assume the host uses default Docker network configuration, with the host // using 172.17.0.1 - let bind_address = format!("tcp://172.17.0.1:1234"); + let bind_address = "tcp://172.17.0.1:1234".to_string(); tcp_server_test("v4", bind_address.as_str()); } @@ -27,7 +27,7 @@ fn test_ipv4_server() { fn test_ipv6_server() { // we assume the host uses default Docker network configuration, with the host // using 172.17.0.1. This is IPv6 notation of the IPv4 address. - let bind_address = format!("tcp://[::ffff:ac11:1]:5678"); + let bind_address = "tcp://[::ffff:ac11:1]:5678".to_string(); tcp_server_test("v6", bind_address.as_str()); } @@ -50,7 +50,7 @@ fn tcp_server_test(test_name: &str, bind_address: &str) { let app = TestDispatcher {}; - let server = ServerBuilder::new(app, &bind_address) + let server = ServerBuilder::new(app, bind_address) .build() .expect("server failed"); let socket_uri = bind_address.to_string();