From 652da823fc97d44ed08eab8d5a16863a7c25d35b Mon Sep 17 00:00:00 2001 From: Kevin Choubacha Date: Thu, 10 May 2018 14:38:06 -0700 Subject: [PATCH] Run cargo fmt for v1.26 Now that there's a new version, there's a small change to the formatter. This updates the code base for that. Added a small disabling rustfmt: #[cfg_attr(rustfmt, rustfmt_skip)] Reference ticket: https://github.com/rust-lang-nursery/rustfmt/issues/2695 --- cli/src/account.rs | 6 +++--- cli/src/assets.rs | 4 ++-- cli/src/effects.rs | 4 ++-- cli/src/error.rs | 4 ++-- cli/src/fmt/simple/account.rs | 2 +- cli/src/fmt/simple/asset.rs | 2 +- cli/src/fmt/simple/effect.rs | 2 +- cli/src/fmt/simple/ledger.rs | 2 +- cli/src/fmt/simple/offer.rs | 2 +- cli/src/fmt/simple/orderbook.rs | 2 +- cli/src/fmt/simple/payment.rs | 2 +- cli/src/fmt/simple/trade_aggregation.rs | 2 +- cli/src/fmt/simple/transaction.rs | 2 +- cli/src/ledgers.rs | 4 ++-- cli/src/main.rs | 12 ++++-------- cli/src/operations.rs | 4 ++-- cli/src/payments.rs | 4 ++-- cli/src/resolution.rs | 2 +- cli/src/trades.rs | 2 +- cli/src/transactions.rs | 4 ++-- client/src/client/async.rs | 6 +++--- client/src/client/sync/iter.rs | 6 +++--- client/src/client/sync/mod.rs | 8 ++++---- client/src/endpoint/account.rs | 6 +++--- client/src/endpoint/asset.rs | 6 +++--- client/src/endpoint/cursor.rs | 2 +- client/src/endpoint/effect.rs | 8 ++++---- client/src/endpoint/ledger.rs | 4 ++-- client/src/endpoint/limit.rs | 2 +- client/src/endpoint/mod.rs | 4 ++-- client/src/endpoint/operation.rs | 4 ++-- client/src/endpoint/order.rs | 2 +- client/src/endpoint/orderbook.rs | 6 +++--- client/src/endpoint/payment.rs | 8 ++++---- client/src/endpoint/trade.rs | 6 +++--- client/src/endpoint/transaction.rs | 4 ++-- client/src/error.rs | 4 ++-- client/src/resources/account.rs | 2 +- client/src/resources/amount.rs | 6 +++--- client/src/resources/base64string.rs | 6 +++--- client/src/resources/deserialize.rs | 2 +- client/src/resources/effect/mod.rs | 7 ++++--- client/src/resources/effect/test.rs | 2 +- client/src/resources/mod.rs | 4 ++-- client/src/resources/operation/mod.rs | 6 +++--- client/src/resources/operation/test.rs | 10 +++++++--- client/src/resources/payment_path.rs | 2 +- client/src/resources/trade.rs | 2 +- client/src/resources/transaction.rs | 2 +- client/src/stellar_error.rs | 2 +- client/src/uri.rs | 4 ++-- 51 files changed, 106 insertions(+), 105 deletions(-) diff --git a/cli/src/account.rs b/cli/src/account.rs index 7ddddcd..975cb40 100644 --- a/cli/src/account.rs +++ b/cli/src/account.rs @@ -1,8 +1,8 @@ -use clap::ArgMatches; -use stellar_client::{sync, endpoint::account, sync::Client}; use super::{cursor, ordering, pager::Pager}; -use fmt::{Formatter, Simple}; +use clap::ArgMatches; use error::Result; +use fmt::{Formatter, Simple}; +use stellar_client::{sync, endpoint::account, sync::Client}; pub fn details(client: &Client, matches: &ArgMatches) -> Result<()> { let id = matches.value_of("ID").expect("ID is required"); diff --git a/cli/src/assets.rs b/cli/src/assets.rs index c6354e9..fb07ccd 100644 --- a/cli/src/assets.rs +++ b/cli/src/assets.rs @@ -1,8 +1,8 @@ -use stellar_client::{endpoint::asset, sync::{self, Client}}; -use clap::ArgMatches; use super::{cursor, ordering, pager::Pager}; +use clap::ArgMatches; use error::Result; use fmt::{Formatter, Simple}; +use stellar_client::{endpoint::asset, sync::{self, Client}}; /// Using a client and the arguments from the command line, iterates over the results /// and displays them to the end user. diff --git a/cli/src/effects.rs b/cli/src/effects.rs index 0bbb6da..d13c06f 100644 --- a/cli/src/effects.rs +++ b/cli/src/effects.rs @@ -1,8 +1,8 @@ -use stellar_client::{endpoint::effect, sync::{self, Client}}; -use clap::ArgMatches; use super::{cursor, ordering, pager::Pager}; +use clap::ArgMatches; use error::Result; use fmt::{Formatter, Simple}; +use stellar_client::{endpoint::effect, sync::{self, Client}}; /// Using a client and the arguments from the command line, iterates over the results /// and displays them to the end user. diff --git a/cli/src/error.rs b/cli/src/error.rs index 86dfdd6..22c8719 100644 --- a/cli/src/error.rs +++ b/cli/src/error.rs @@ -1,8 +1,8 @@ -use stellar_client::error::Error; +use resolution::ParseResolutionError; use std::error::Error as StdError; use std::fmt; use std::num::ParseIntError; -use resolution::ParseResolutionError; +use stellar_client::error::Error; /// A result including client specific errors. pub type Result = ::std::result::Result; diff --git a/cli/src/fmt/simple/account.rs b/cli/src/fmt/simple/account.rs index 9e673f8..e043455 100644 --- a/cli/src/fmt/simple/account.rs +++ b/cli/src/fmt/simple/account.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::Account; impl Render for Simple { diff --git a/cli/src/fmt/simple/asset.rs b/cli/src/fmt/simple/asset.rs index a5089a7..39222aa 100644 --- a/cli/src/fmt/simple/asset.rs +++ b/cli/src/fmt/simple/asset.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::Asset; impl Render for Simple { diff --git a/cli/src/fmt/simple/effect.rs b/cli/src/fmt/simple/effect.rs index 9c12d41..eb35d5a 100644 --- a/cli/src/fmt/simple/effect.rs +++ b/cli/src/fmt/simple/effect.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::{AssetIdentifier, effect::{Effect, EffectKind as Kind}}; impl Render for Simple { diff --git a/cli/src/fmt/simple/ledger.rs b/cli/src/fmt/simple/ledger.rs index d3072ce..28bee1c 100644 --- a/cli/src/fmt/simple/ledger.rs +++ b/cli/src/fmt/simple/ledger.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::Ledger; impl Render for Simple { diff --git a/cli/src/fmt/simple/offer.rs b/cli/src/fmt/simple/offer.rs index ac0b0f7..14c2ccb 100644 --- a/cli/src/fmt/simple/offer.rs +++ b/cli/src/fmt/simple/offer.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::{AssetIdentifier, Offer}; fn render_asset(id: &AssetIdentifier) -> String { diff --git a/cli/src/fmt/simple/orderbook.rs b/cli/src/fmt/simple/orderbook.rs index b63d431..bbb949f 100644 --- a/cli/src/fmt/simple/orderbook.rs +++ b/cli/src/fmt/simple/orderbook.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::Orderbook; impl Render for Simple { diff --git a/cli/src/fmt/simple/payment.rs b/cli/src/fmt/simple/payment.rs index 1b24c1e..06b6b1a 100644 --- a/cli/src/fmt/simple/payment.rs +++ b/cli/src/fmt/simple/payment.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::{Operation, OperationKind}; impl Render for Simple { diff --git a/cli/src/fmt/simple/trade_aggregation.rs b/cli/src/fmt/simple/trade_aggregation.rs index 56f29da..5fc15fb 100644 --- a/cli/src/fmt/simple/trade_aggregation.rs +++ b/cli/src/fmt/simple/trade_aggregation.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::TradeAggregation; impl Render for Simple { diff --git a/cli/src/fmt/simple/transaction.rs b/cli/src/fmt/simple/transaction.rs index b7eb462..71995e6 100644 --- a/cli/src/fmt/simple/transaction.rs +++ b/cli/src/fmt/simple/transaction.rs @@ -1,5 +1,5 @@ -use fmt::Render; use super::Simple; +use fmt::Render; use stellar_client::resources::Transaction; impl Render for Simple { diff --git a/cli/src/ledgers.rs b/cli/src/ledgers.rs index 2860b51..f940509 100644 --- a/cli/src/ledgers.rs +++ b/cli/src/ledgers.rs @@ -1,8 +1,8 @@ -use stellar_client::{endpoint::ledger, sync::{self, Client}}; +use super::{cursor, ordering, pager::Pager}; use clap::ArgMatches; use error::Result; use fmt::{Formatter, Simple}; -use super::{cursor, ordering, pager::Pager}; +use stellar_client::{endpoint::ledger, sync::{self, Client}}; pub fn all(client: &Client, matches: &ArgMatches) -> Result<()> { let pager = Pager::from_arg(&matches); diff --git a/cli/src/main.rs b/cli/src/main.rs index a084ffb..1b743cb 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -5,13 +5,13 @@ extern crate clap; extern crate stellar_client; use clap::{App, AppSettings, Arg, SubCommand}; +use error::CliError; use pager::Pager; use stellar_client::{error::Error, sync::Client}; -use error::CliError; mod account; -mod assets; mod asset_identifier; +mod assets; mod cursor; mod effects; mod error; @@ -29,12 +29,8 @@ mod transactions; fn build_app<'a, 'b>() -> App<'a, 'b> { macro_rules! listable { ($e:expr) => { - Pager::add( - ordering::add( - cursor::add($e) - ) - ) - } + Pager::add(ordering::add(cursor::add($e))) + }; } App::new("Stellar CLI") diff --git a/cli/src/operations.rs b/cli/src/operations.rs index 3a4d538..8271672 100644 --- a/cli/src/operations.rs +++ b/cli/src/operations.rs @@ -1,8 +1,8 @@ -use stellar_client::{endpoint::operation, sync::{self, Client}}; -use clap::ArgMatches; use super::{cursor, ordering, pager::Pager}; +use clap::ArgMatches; use error::Result; use fmt::{Formatter, Simple}; +use stellar_client::{endpoint::operation, sync::{self, Client}}; pub fn all(client: &Client, matches: &ArgMatches) -> Result<()> { let pager = Pager::from_arg(&matches); diff --git a/cli/src/payments.rs b/cli/src/payments.rs index 76137d1..6d8d226 100644 --- a/cli/src/payments.rs +++ b/cli/src/payments.rs @@ -1,8 +1,8 @@ -use stellar_client::{endpoint::payment, sync::{self, Client}}; +use super::{cursor, ordering, pager::Pager}; use clap::ArgMatches; use error::Result; use fmt::{Formatter, Simple}; -use super::{cursor, ordering, pager::Pager}; +use stellar_client::{endpoint::payment, sync::{self, Client}}; pub fn all(client: &Client, matches: &ArgMatches) -> Result<()> { let pager = Pager::from_arg(&matches); diff --git a/cli/src/resolution.rs b/cli/src/resolution.rs index 187b832..2ca0bab 100644 --- a/cli/src/resolution.rs +++ b/cli/src/resolution.rs @@ -1,5 +1,5 @@ -use std::str::FromStr; use self::Resolution::{Day, Hour, Min, Sec}; +use std::str::FromStr; /// Represents durations of time for the trade aggregations endpoint. pub enum Resolution { diff --git a/cli/src/trades.rs b/cli/src/trades.rs index abd4da3..756963b 100644 --- a/cli/src/trades.rs +++ b/cli/src/trades.rs @@ -1,3 +1,4 @@ +use super::{cursor, ordering, pager::Pager}; use asset_identifier; use chrono::{DateTime, Utc}; use clap::ArgMatches; @@ -5,7 +6,6 @@ use error::Result; use fmt::{Formatter, Simple}; use resolution::Resolution; use stellar_client::{endpoint::trade, sync::{self, Client}}; -use super::{cursor, ordering, pager::Pager}; pub fn all(client: &Client, matches: &ArgMatches) -> Result<()> { let pager = Pager::from_arg(&matches); diff --git a/cli/src/transactions.rs b/cli/src/transactions.rs index 741cb32..6f782b2 100644 --- a/cli/src/transactions.rs +++ b/cli/src/transactions.rs @@ -1,8 +1,8 @@ -use stellar_client::{endpoint::transaction, sync::{self, Client}}; -use clap::ArgMatches; use super::{cursor, ordering, pager::Pager}; +use clap::ArgMatches; use error::Result; use fmt::{Formatter, Simple}; +use stellar_client::{endpoint::transaction, sync::{self, Client}}; pub fn all(client: &Client, matches: &ArgMatches) -> Result<()> { let pager = Pager::from_arg(&matches); diff --git a/client/src/client/async.rs b/client/src/client/async.rs index aa31d14..1e14b29 100644 --- a/client/src/client/async.rs +++ b/client/src/client/async.rs @@ -1,11 +1,11 @@ //! This module contains the client for asynchronous communcation. +use super::{Host, HORIZON_TEST_URI, HORIZON_URI}; +use error::{Error, Result}; +use http; use hyper; use hyper_tls::HttpsConnector; -use http; use tokio_core::reactor::Handle; -use error::{Error, Result}; -use super::{Host, HORIZON_TEST_URI, HORIZON_URI}; /// A client that can issue requests to a horizon api. #[derive(Debug, Clone)] diff --git a/client/src/client/sync/iter.rs b/client/src/client/sync/iter.rs index fad2dc0..f062134 100644 --- a/client/src/client/sync/iter.rs +++ b/client/src/client/sync/iter.rs @@ -1,8 +1,8 @@ -use endpoint::{IntoRequest, Records}; -use uri::TryFromUri; -use serde::de::DeserializeOwned; use super::Client; +use endpoint::{IntoRequest, Records}; use error::Result; +use serde::de::DeserializeOwned; +use uri::TryFromUri; /// An iterator for records. Provides the ability to use the iterator /// in rust against records that are returned from the api. diff --git a/client/src/client/sync/mod.rs b/client/src/client/sync/mod.rs index 4edc974..7975211 100644 --- a/client/src/client/sync/mod.rs +++ b/client/src/client/sync/mod.rs @@ -13,12 +13,12 @@ //! let client = Client::new("https://horizon-testnet.stellar.org").unwrap(); //! ``` -use reqwest; -use http::{self, Uri}; -use error::{Error, Result}; -use endpoint::IntoRequest; use super::{Host, HORIZON_TEST_URI, HORIZON_URI}; use StellarError; +use endpoint::IntoRequest; +use error::{Error, Result}; +use http::{self, Uri}; +use reqwest; use serde_json; mod iter; diff --git a/client/src/endpoint/account.rs b/client/src/endpoint/account.rs index e3a512d..dfd3e29 100644 --- a/client/src/endpoint/account.rs +++ b/client/src/endpoint/account.rs @@ -1,9 +1,9 @@ //! Contains endpoints for accessing accounts and related information. -use error::Result; -use std::str::FromStr; -use resources::{Account, Datum, Effect, Offer, Operation, Transaction}; use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; +use error::Result; use http::{Request, Uri}; +use resources::{Account, Datum, Effect, Offer, Operation, Transaction}; +use std::str::FromStr; use uri::{self, TryFromUri, UriWrap}; /// Represents the account details on the stellar horizon server. diff --git a/client/src/endpoint/asset.rs b/client/src/endpoint/asset.rs index 70ebcce..f233f55 100644 --- a/client/src/endpoint/asset.rs +++ b/client/src/endpoint/asset.rs @@ -1,9 +1,9 @@ //! Contains endpoints for assets and related information to specific assets. -use error::Result; -use std::str::FromStr; -use resources::Asset; use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; +use error::Result; use http::{Request, Uri}; +use resources::Asset; +use std::str::FromStr; use uri::{self, TryFromUri, UriWrap}; /// Represents the all assets end point for the stellar horizon server. The endpoint diff --git a/client/src/endpoint/cursor.rs b/client/src/endpoint/cursor.rs index e48e380..46dcd75 100644 --- a/client/src/endpoint/cursor.rs +++ b/client/src/endpoint/cursor.rs @@ -35,7 +35,7 @@ macro_rules! impl_cursor { self.cursor.as_ref().map(|s| &**s) } } - } + }; } #[cfg(test)] diff --git a/client/src/endpoint/effect.rs b/client/src/endpoint/effect.rs index 56f66ab..94f0e35 100644 --- a/client/src/endpoint/effect.rs +++ b/client/src/endpoint/effect.rs @@ -1,15 +1,15 @@ //! Contains the endpoint for all effects. -use error::Result; -use std::str::FromStr; -use resources::Effect; use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; +use error::Result; use http::{Request, Uri}; +use resources::Effect; +use std::str::FromStr; use uri::{self, TryFromUri, UriWrap}; pub use super::account::Effects as ForAccount; pub use super::ledger::Effects as ForLedger; -pub use super::transaction::Effects as ForTransaction; pub use super::operation::Effects as ForOperation; +pub use super::transaction::Effects as ForTransaction; /// This endpoint represents all effects that have resulted from successful opreations in Stellar. /// The endpoint will return all effects and accepts query params for a cursor, order, and limit. diff --git a/client/src/endpoint/ledger.rs b/client/src/endpoint/ledger.rs index ae1f7d3..9fa4433 100644 --- a/client/src/endpoint/ledger.rs +++ b/client/src/endpoint/ledger.rs @@ -1,9 +1,9 @@ //! Contains the endpoint for all ledgers. +use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; use error::Result; use http::{Request, Uri}; -use std::str::FromStr; use resources::{Effect, Ledger, Operation, Transaction}; -use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; +use std::str::FromStr; use uri::{self, TryFromUri, UriWrap}; /// Represents the all ledgers end point for the stellar horizon server. The endpoint diff --git a/client/src/endpoint/limit.rs b/client/src/endpoint/limit.rs index ca48874..49098c6 100644 --- a/client/src/endpoint/limit.rs +++ b/client/src/endpoint/limit.rs @@ -27,7 +27,7 @@ macro_rules! impl_limit { self.limit } } - } + }; } #[cfg(test)] diff --git a/client/src/endpoint/mod.rs b/client/src/endpoint/mod.rs index 85a0405..0e14fc2 100644 --- a/client/src/endpoint/mod.rs +++ b/client/src/endpoint/mod.rs @@ -18,8 +18,8 @@ //! let all_txns = client.request(txns).unwrap(); //! ``` use error::Result; -use serde::de::DeserializeOwned; use http; +use serde::de::DeserializeOwned; #[macro_use] mod cursor; @@ -42,8 +42,8 @@ pub mod transaction; pub use self::cursor::Cursor; pub use self::limit::Limit; -pub use self::records::Records; pub use self::order::{Direction, Order, ParseDirectionError}; +pub use self::records::Records; /// Represents the body of a request to an IntoRequest. #[derive(Debug)] diff --git a/client/src/endpoint/operation.rs b/client/src/endpoint/operation.rs index c6170f4..9879eed 100644 --- a/client/src/endpoint/operation.rs +++ b/client/src/endpoint/operation.rs @@ -1,9 +1,9 @@ //! Contains the endpoint for all operations. +use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; use error::Result; use http::{Request, Uri}; -use std::str::FromStr; use resources::{Effect, Operation}; -use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; +use std::str::FromStr; use uri::{self, TryFromUri, UriWrap}; pub use super::account::Operations as ForAccount; diff --git a/client/src/endpoint/order.rs b/client/src/endpoint/order.rs index a63cdb5..b4b74f5 100644 --- a/client/src/endpoint/order.rs +++ b/client/src/endpoint/order.rs @@ -33,7 +33,7 @@ macro_rules! impl_order { self.order } } - } + }; } /// The order to return results in. diff --git a/client/src/endpoint/orderbook.rs b/client/src/endpoint/orderbook.rs index fbb8475..7b62035 100644 --- a/client/src/endpoint/orderbook.rs +++ b/client/src/endpoint/orderbook.rs @@ -1,9 +1,9 @@ //! Contains the endpoint for fetching the orderbook for a given asset pair -use error::Result; -use std::str::FromStr; -use resources::{AssetIdentifier, Orderbook}; use super::{Body, IntoRequest, Limit}; +use error::Result; use http::{Request, Uri}; +use resources::{AssetIdentifier, Orderbook}; +use std::str::FromStr; /// Given an asset pair, the endpoint will return all bids and asks with an optional /// limit parameter to cap the number of records returned. diff --git a/client/src/endpoint/payment.rs b/client/src/endpoint/payment.rs index b3ad2bb..bc3d0b9 100644 --- a/client/src/endpoint/payment.rs +++ b/client/src/endpoint/payment.rs @@ -1,14 +1,14 @@ //! Contains the endpoint for all payment operations. +use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; use error::Result; use http::{Request, Uri}; -use std::str::FromStr; use resources::{Amount, AssetIdentifier, Operation, PaymentPath}; -use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; +use std::str::FromStr; use uri::{self, TryFromUri, UriWrap}; -pub use super::transaction::Payments as ForTransaction; -pub use super::ledger::Payments as ForLedger; pub use super::account::Payments as ForAccount; +pub use super::ledger::Payments as ForLedger; +pub use super::transaction::Payments as ForTransaction; /// This endpoint represents all payment operations that are part of validated transactions. /// The endpoint will return all payments and accepts query params for a cursor, order, and limit. diff --git a/client/src/endpoint/trade.rs b/client/src/endpoint/trade.rs index e12262e..de9e2cf 100644 --- a/client/src/endpoint/trade.rs +++ b/client/src/endpoint/trade.rs @@ -1,9 +1,9 @@ //! Contains the endpoint for all trades. -use error::Result; -use std::str::FromStr; -use resources::{AssetIdentifier, Trade, TradeAggregation}; use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; +use error::Result; use http::{Request, Uri}; +use resources::{AssetIdentifier, Trade, TradeAggregation}; +use std::str::FromStr; use uri::{self, TryFromUri, UriWrap}; /// Private struct used to define a trade pair. diff --git a/client/src/endpoint/transaction.rs b/client/src/endpoint/transaction.rs index 95e2d7f..0a7c246 100644 --- a/client/src/endpoint/transaction.rs +++ b/client/src/endpoint/transaction.rs @@ -1,9 +1,9 @@ //! Contains endpoints for transactions and related information. +use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; use error::Result; use http::{Request, Uri}; -use std::str::FromStr; use resources::{Effect, Operation, Transaction}; -use super::{Body, Cursor, Direction, IntoRequest, Limit, Order, Records}; +use std::str::FromStr; use uri::{self, TryFromUri, UriWrap}; pub use super::account::Transactions as ForAccount; diff --git a/client/src/error.rs b/client/src/error.rs index 244d335..6e6c752 100644 --- a/client/src/error.rs +++ b/client/src/error.rs @@ -1,12 +1,12 @@ //! Error and result module +use super::StellarError; use http; -use hyper::error::UriError; use hyper; +use hyper::error::UriError; use reqwest; use serde_json; use std::error::Error as StdError; use std::fmt; -use super::StellarError; use uri; /// A set of errors for use in the client diff --git a/client/src/resources/account.rs b/client/src/resources/account.rs index baa917d..efb5737 100644 --- a/client/src/resources/account.rs +++ b/client/src/resources/account.rs @@ -1,6 +1,6 @@ use super::deserialize; -use std::collections::HashMap; use resources::base64string::Base64String; +use std::collections::HashMap; /// In the Stellar network, users interact using accounts which can be controlled by a /// corresponding keypair that can authorize transactions. diff --git a/client/src/resources/amount.rs b/client/src/resources/amount.rs index dd838fe..a339e4f 100644 --- a/client/src/resources/amount.rs +++ b/client/src/resources/amount.rs @@ -1,7 +1,7 @@ +use serde::de; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::fmt; use std::ops::{Add, Sub}; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use serde::de; use std::str::FromStr; /// Amounts are used in several resources in the stellar ecosystem. There @@ -170,8 +170,8 @@ impl<'de> Deserialize<'de> for Amount { #[cfg(test)] mod deserialize_amount_tests { - use serde_json; use super::*; + use serde_json; #[test] fn it_raises_amount_by_ten_million() { diff --git a/client/src/resources/base64string.rs b/client/src/resources/base64string.rs index 004f001..9ccc2b1 100644 --- a/client/src/resources/base64string.rs +++ b/client/src/resources/base64string.rs @@ -1,6 +1,6 @@ -use std::fmt; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; use base64::{decode, encode}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use std::fmt; /// Base64 encoded Strings are used in several resources in the stellar ecosystem. There /// are encoding and decoding conversions that must take place to display data to users @@ -96,8 +96,8 @@ impl<'de> Deserialize<'de> for Base64String { #[cfg(test)] mod deserialize_base64string_tests { - use serde_json; use super::*; + use serde_json; #[test] fn it_decodes_base64() { diff --git a/client/src/resources/deserialize.rs b/client/src/resources/deserialize.rs index a5a55de..810a58c 100644 --- a/client/src/resources/deserialize.rs +++ b/client/src/resources/deserialize.rs @@ -1,5 +1,5 @@ -use serde::{Deserialize, Deserializer}; use serde::de; +use serde::{Deserialize, Deserializer}; use std::str::FromStr; /// Some fields in the json are represented as "strings" but are actually diff --git a/client/src/resources/effect/mod.rs b/client/src/resources/effect/mod.rs index 010a943..5430b26 100644 --- a/client/src/resources/effect/mod.rs +++ b/client/src/resources/effect/mod.rs @@ -622,9 +622,10 @@ impl<'de> Deserialize<'de> for Effect { } => { let asset_identifier = AssetIdentifier::new(&asset_type, asset_code, trustor) .map_err(de::Error::custom)?; - Kind::Trustline(trustline::Kind::Deauthorized( - trustline::Deauthorized::new(account, asset_identifier), - )) + Kind::Trustline(trustline::Kind::Deauthorized(trustline::Deauthorized::new( + account, + asset_identifier, + ))) } _ => { return Err(de::Error::custom( diff --git a/client/src/resources/effect/test.rs b/client/src/resources/effect/test.rs index 32a26fa..f417d87 100644 --- a/client/src/resources/effect/test.rs +++ b/client/src/resources/effect/test.rs @@ -418,7 +418,7 @@ mod errors_on_missing_fields_for_effect_types { format!("Missing fields for {} effect.", stringify!($type_to_check)) ); } - } + }; } assert_err_on_missing_fields!(account_created, 0); diff --git a/client/src/resources/mod.rs b/client/src/resources/mod.rs index 02c15c6..d4775eb 100644 --- a/client/src/resources/mod.rs +++ b/client/src/resources/mod.rs @@ -31,9 +31,9 @@ pub use self::datum::Datum; pub use self::effect::Effect; pub use self::ledger::Ledger; pub use self::offer::Offer; -pub use self::payment_path::PaymentPath; pub use self::operation::{Operation, OperationKind}; pub use self::orderbook::Orderbook; +pub use self::payment_path::PaymentPath; pub use self::trade::{Seller as TradeSeller, Trade, TradeAggregation}; -pub use self::transaction::Transaction; pub use self::transaction::Memo; +pub use self::transaction::Transaction; diff --git a/client/src/resources/operation/mod.rs b/client/src/resources/operation/mod.rs index 4e0407f..9c3e9b5 100644 --- a/client/src/resources/operation/mod.rs +++ b/client/src/resources/operation/mod.rs @@ -1,5 +1,5 @@ -use resources::{Amount, AssetIdentifier, asset::Flags, offer::PriceRatio}; use super::deserialize; +use resources::{Amount, AssetIdentifier, asset::Flags, offer::PriceRatio}; use serde::{de, Deserialize, Deserializer}; mod account_merge; mod allow_trust; @@ -8,8 +8,8 @@ mod create_account; mod create_passive_offer; mod manage_data; mod manage_offer; -mod payment; mod path_payment; +mod payment; mod set_options; pub use self::account_merge::AccountMerge; @@ -19,8 +19,8 @@ pub use self::create_account::CreateAccount; pub use self::create_passive_offer::CreatePassiveOffer; pub use self::manage_data::ManageData; pub use self::manage_offer::ManageOffer; -pub use self::payment::Payment; pub use self::path_payment::PathPayment; +pub use self::payment::Payment; pub use self::set_options::SetOptions; #[cfg(test)] diff --git a/client/src/resources/operation/test.rs b/client/src/resources/operation/test.rs index 60523f5..c60fc30 100644 --- a/client/src/resources/operation/test.rs +++ b/client/src/resources/operation/test.rs @@ -1,5 +1,5 @@ -use serde_json; use resources::{Amount, Operation, OperationKind, asset::Flags}; +use serde_json; fn account_merge_json() -> &'static str { include_str!("../../../fixtures/operations/account_merge.json") @@ -8,6 +8,7 @@ fn account_merge_json() -> &'static str { mod errors_on_missing_fields_for_type { use super::*; + #[cfg_attr(rustfmt, rustfmt_skip)] macro_rules! assert_err_on_missing_fields { ($type_to_check:ident, $type_i:expr) => { #[test] @@ -28,10 +29,13 @@ mod errors_on_missing_fields_for_type { assert!(result.is_err()); assert_eq!( format!("{}", result.unwrap_err()), - format!("Missing fields for {} operation.", stringify!($type_to_check)) + format!( + "Missing fields for {} operation.", + stringify!($type_to_check) + ) ); } - } + }; } assert_err_on_missing_fields!(create_account, 0); diff --git a/client/src/resources/payment_path.rs b/client/src/resources/payment_path.rs index 9c8af2b..fc520a6 100644 --- a/client/src/resources/payment_path.rs +++ b/client/src/resources/payment_path.rs @@ -1,5 +1,5 @@ -use serde::{de, Deserialize, Deserializer}; use super::{amount::Amount, asset::AssetIdentifier}; +use serde::{de, Deserialize, Deserializer}; /// A path resource contains information about a payment path. A path can be used by code to /// populate necessary fields on path payment operation, such as path and sendMax. The diff --git a/client/src/resources/trade.rs b/client/src/resources/trade.rs index 001be98..e0d23b8 100644 --- a/client/src/resources/trade.rs +++ b/client/src/resources/trade.rs @@ -1,5 +1,5 @@ -use chrono::prelude::*; use super::{amount::Amount, asset::AssetIdentifier, offer::PriceRatio}; +use chrono::prelude::*; use serde::{de, Deserialize, Deserializer}; /// A trade represents an offer that was fulfilled between two assets and accounts. diff --git a/client/src/resources/transaction.rs b/client/src/resources/transaction.rs index 8144658..e710496 100644 --- a/client/src/resources/transaction.rs +++ b/client/src/resources/transaction.rs @@ -1,5 +1,5 @@ -use chrono::prelude::*; use super::{deserialize, amount::Amount}; +use chrono::prelude::*; /// Memos are a useful source for adding meta data to a transaction. /// A consists of a type and content (unless memo type is none). diff --git a/client/src/stellar_error.rs b/client/src/stellar_error.rs index bf89d29..2b6527a 100644 --- a/client/src/stellar_error.rs +++ b/client/src/stellar_error.rs @@ -1,5 +1,5 @@ -use std::error::Error; use serde::{de, Deserialize, Deserializer}; +use std::error::Error; use std::{fmt, str::FromStr}; /// A resource for the stellar horizon API specific error codes. diff --git a/client/src/uri.rs b/client/src/uri.rs index ddf95a0..e58e654 100644 --- a/client/src/uri.rs +++ b/client/src/uri.rs @@ -1,7 +1,7 @@ +use endpoint::ParseDirectionError; use http; -use std::{self, fmt}; use std::str::FromStr; -use endpoint::ParseDirectionError; +use std::{self, fmt}; /// A trait that, if implemented, can convert to itself from a URi /// and returns errors when needed.