From afa2c2347f56e6f7eaebb756b17231373b86f2fd Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Tue, 18 Feb 2020 11:32:25 -0800 Subject: [PATCH] fmt --- zebra-chain/src/transaction.rs | 4 ++-- zebra-network/src/lib.rs | 4 ++-- zebra-network/src/peer_set/initialize.rs | 17 +++++++++++++++-- zebra-network/src/policies.rs | 2 +- zebrad/src/commands/config.rs | 4 ++-- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/zebra-chain/src/transaction.rs b/zebra-chain/src/transaction.rs index 37472c1b..0376592c 100644 --- a/zebra-chain/src/transaction.rs +++ b/zebra-chain/src/transaction.rs @@ -93,7 +93,7 @@ pub enum Transaction { impl Transaction { /// Iterate over the transparent inputs of this transaction, if any. - pub fn inputs(&self) -> impl Iterator { + pub fn inputs(&self) -> impl Iterator { match self { Transaction::V1 { ref inputs, .. } => inputs.iter(), Transaction::V2 { ref inputs, .. } => inputs.iter(), @@ -103,7 +103,7 @@ impl Transaction { } /// Iterate over the transparent outputs of this transaction, if any. - pub fn outputs(&self) -> impl Iterator { + pub fn outputs(&self) -> impl Iterator { match self { Transaction::V1 { ref outputs, .. } => outputs.iter(), Transaction::V2 { ref outputs, .. } => outputs.iter(), diff --git a/zebra-network/src/lib.rs b/zebra-network/src/lib.rs index afd13cd1..492107f3 100644 --- a/zebra-network/src/lib.rs +++ b/zebra-network/src/lib.rs @@ -52,9 +52,9 @@ mod config; mod constants; mod meta_addr; mod network; -mod policies; mod peer; mod peer_set; +mod policies; mod protocol; mod timestamp_collector; @@ -62,8 +62,8 @@ pub use crate::{ address_book::AddressBook, config::Config, peer_set::init, - protocol::internal::{Request, Response}, policies::{RetryErrors, RetryLimit}, + protocol::internal::{Request, Response}, }; /// Types used in the definition of [`Request`] and [`Response`] messages. diff --git a/zebra-network/src/peer_set/initialize.rs b/zebra-network/src/peer_set/initialize.rs index 38d11e02..9789b88a 100644 --- a/zebra-network/src/peer_set/initialize.rs +++ b/zebra-network/src/peer_set/initialize.rs @@ -197,7 +197,14 @@ where /// Given a channel that signals a need for new peers, try to connect to a peer /// and send the resulting `peer::Client` through a channel. -#[instrument(skip(new_peer_interval, demand_tx, demand_rx, candidates, connector, success_tx))] +#[instrument(skip( + new_peer_interval, + demand_tx, + demand_rx, + candidates, + connector, + success_tx +))] async fn crawl_and_dial( new_peer_interval: std::time::Duration, mut demand_tx: mpsc::Sender<()>, @@ -213,7 +220,13 @@ where S: Service, S::Future: Send + 'static, { - use futures::{future::{select, Either::{Left, Right}}, TryFutureExt}; + use futures::{ + future::{ + select, + Either::{Left, Right}, + }, + TryFutureExt, + }; let mut handshakes = FuturesUnordered::new(); // returns None when empty. diff --git a/zebra-network/src/policies.rs b/zebra-network/src/policies.rs index 61a8f237..2e2fdf05 100644 --- a/zebra-network/src/policies.rs +++ b/zebra-network/src/policies.rs @@ -1,5 +1,5 @@ -use tower::retry::Policy; use futures::future; +use tower::retry::Policy; /// A very basic retry policy with a limited number of retry attempts. /// diff --git a/zebrad/src/commands/config.rs b/zebrad/src/commands/config.rs index 3716babc..67cb65d8 100644 --- a/zebrad/src/commands/config.rs +++ b/zebrad/src/commands/config.rs @@ -28,11 +28,11 @@ impl Runnable for ConfigCmd { " .to_owned(); // The default name and location of the config file is defined in ../commands.rs + // this avoids a ValueAfterTable error // https://github.com/alexcrichton/toml-rs/issues/145 let conf = toml::Value::try_from(default_config).unwrap(); - output += &toml::to_string_pretty(&conf) - .expect("default config should be serializable"); + output += &toml::to_string_pretty(&conf).expect("default config should be serializable"); match self.output_file { Some(ref output_file) => { use std::{fs::File, io::Write};