diff --git a/abci/tests/common/docker.rs b/abci/tests/common/docker.rs index e5e673a..31a890b 100644 --- a/abci/tests/common/docker.rs +++ b/abci/tests/common/docker.rs @@ -269,6 +269,6 @@ 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 aec9fa8..a243363 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 80b95dd..8b43976 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(); diff --git a/proto-compiler/src/functions.rs b/proto-compiler/src/functions.rs index fb73454..857a49d 100644 --- a/proto-compiler/src/functions.rs +++ b/proto-compiler/src/functions.rs @@ -142,7 +142,7 @@ pub fn abci_version>(dir: T) -> String { let contents = read_to_string(&file_path).expect("cannot read version/version.go"); use regex::Regex; - let re = Regex::new(r##"(?m)^\s+ABCISemVer\s*=\s*"([^"]+)"\s+*$"##).unwrap(); + let re = Regex::new(r#"(?m)^\s+ABCISemVer\s*=\s*"([^"]+)"\s+*$"#).unwrap(); let captures = re .captures(&contents) .expect("cannot find ABCISemVer in version/version.go");