From 9358f81ac1f3673e251d010d04f2825c6bb81be3 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Tue, 9 May 2017 14:24:45 +0200 Subject: [PATCH] fix indentation --- ethcore/light/src/lib.rs | 4 +- ethcore/light/src/on_demand/request.rs | 88 +++++++++++++------------- ethcore/light/src/transaction_queue.rs | 2 +- 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 82b6ea126..5e970b837 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -44,13 +44,13 @@ pub mod provider; #[cfg(feature = "ipc")] pub mod provider { - #![allow(dead_code, unused_assignments, unused_variables, missing_docs)] // codegen issues + #![allow(dead_code, unused_assignments, unused_variables, missing_docs)] // codegen issues include!(concat!(env!("OUT_DIR"), "/provider.rs")); } #[cfg(feature = "ipc")] pub mod remote { - pub use provider::LightProviderClient; + pub use provider::LightProviderClient; } mod types; diff --git a/ethcore/light/src/on_demand/request.rs b/ethcore/light/src/on_demand/request.rs index 8361661eb..4039c2cb3 100644 --- a/ethcore/light/src/on_demand/request.rs +++ b/ethcore/light/src/on_demand/request.rs @@ -58,33 +58,33 @@ pub enum Request { /// A request argument. pub trait RequestArg { /// the response type. - type Out; + type Out; /// Create the request type. /// `extract` must not fail when presented with the corresponding /// `Response`. - fn make(self) -> Request; + fn make(self) -> Request; /// May not panic if the response corresponds with the request /// from `make`. /// Is free to panic otherwise. - fn extract(r: Response) -> Self::Out; + fn extract(r: Response) -> Self::Out; } /// An adapter can be thought of as a grouping of request argument types. /// This is implemented for various tuples and convenient types. pub trait RequestAdapter { /// The output type. - type Out; + type Out; /// Infallibly produce requests. When `extract_from` is presented /// with the corresponding response vector, it may not fail. - fn make_requests(self) -> Vec; + fn make_requests(self) -> Vec; /// Extract the output type from the given responses. /// If they are the corresponding responses to the requests /// made by `make_requests`, do not panic. - fn extract_from(Vec) -> Self::Out; + fn extract_from(Vec) -> Self::Out; } // helper to implement `RequestArg` and `From` for a single request kind. @@ -123,54 +123,54 @@ impl_single!(Code, Code, Bytes); impl_single!(Execution, TransactionProof, super::ExecutionResult); macro_rules! impl_args { - () => { - impl RequestAdapter for T { - type Out = T::Out; + () => { + impl RequestAdapter for T { + type Out = T::Out; - fn make_requests(self) -> Vec { - vec![self.make()] - } + fn make_requests(self) -> Vec { + vec![self.make()] + } - fn extract_from(mut responses: Vec) -> Self::Out { - T::extract(responses.pop().expect(SUPPLIED_MATCHES)) - } - } - }; - ($first: ident, $($next: ident,)*) => { - impl< - $first: RequestArg, - $($next: RequestArg,)* - > - RequestAdapter for ($first, $($next,)*) { - type Out = ($first::Out, $($next::Out,)*); + fn extract_from(mut responses: Vec) -> Self::Out { + T::extract(responses.pop().expect(SUPPLIED_MATCHES)) + } + } + }; + ($first: ident, $($next: ident,)*) => { + impl< + $first: RequestArg, + $($next: RequestArg,)* + > + RequestAdapter for ($first, $($next,)*) { + type Out = ($first::Out, $($next::Out,)*); - fn make_requests(self) -> Vec { - let ($first, $($next,)*) = self; + fn make_requests(self) -> Vec { + let ($first, $($next,)*) = self; - vec![ - $first.make(), - $($next.make(),)* - ] - } + vec![ + $first.make(), + $($next.make(),)* + ] + } - fn extract_from(responses: Vec) -> Self::Out { - let mut iter = responses.into_iter(); - ( - $first::extract(iter.next().expect(SUPPLIED_MATCHES)), - $($next::extract(iter.next().expect(SUPPLIED_MATCHES)),)* - ) - } - } - impl_args!($($next,)*); - } + fn extract_from(responses: Vec) -> Self::Out { + let mut iter = responses.into_iter(); + ( + $first::extract(iter.next().expect(SUPPLIED_MATCHES)), + $($next::extract(iter.next().expect(SUPPLIED_MATCHES)),)* + ) + } + } + impl_args!($($next,)*); + } } mod impls { - #![allow(non_snake_case)] + #![allow(non_snake_case)] - use super::{RequestAdapter, RequestArg, Request, Response, SUPPLIED_MATCHES}; + use super::{RequestAdapter, RequestArg, Request, Response, SUPPLIED_MATCHES}; - impl_args!(A, B, C, D, E, F, G, H, I, J, K, L,); + impl_args!(A, B, C, D, E, F, G, H, I, J, K, L,); } /// Requests coupled with their required data for verification. diff --git a/ethcore/light/src/transaction_queue.rs b/ethcore/light/src/transaction_queue.rs index d17a863f5..7ce2bd53d 100644 --- a/ethcore/light/src/transaction_queue.rs +++ b/ethcore/light/src/transaction_queue.rs @@ -131,7 +131,7 @@ impl TransactionQueue { if self.by_hash.contains_key(&hash) { return Err(TransactionError::AlreadyImported) } - let res = match self.by_account.entry(sender) { + let res = match self.by_account.entry(sender) { Entry::Vacant(entry) => { entry.insert(AccountTransactions { cur_nonce: CurrentNonce::Assumed(nonce),