Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Dec 14, 2023
1 parent f413119 commit 6401145
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion abci/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'a, App: RequestDispatcher + 'a> ServerBuilder<App> {
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")]
Expand Down
12 changes: 6 additions & 6 deletions abci/src/server/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 6 additions & 4 deletions abci/tests/common/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -269,6 +269,8 @@ impl Drop for TenderdashDocker {
pub fn setup_td_logs_panic(td_docker: &Arc<TenderdashDocker>) {
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()
}
}));
}
3 changes: 1 addition & 2 deletions abci/tests/kvstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod common;

use std::{
collections::{BTreeMap, BTreeSet},
mem,
ops::Deref,
sync::{RwLock, RwLockWriteGuard},
};
Expand Down Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions abci/tests/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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();
Expand Down

0 comments on commit 6401145

Please sign in to comment.