Skip to content

Commit

Permalink
Run cargo fmt for v1.26
Browse files Browse the repository at this point in the history
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:
rust-lang/rustfmt#2695
  • Loading branch information
choubacha committed May 11, 2018
1 parent 876e47f commit 652da82
Show file tree
Hide file tree
Showing 51 changed files with 106 additions and 105 deletions.
6 changes: 3 additions & 3 deletions cli/src/account.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
4 changes: 2 additions & 2 deletions cli/src/assets.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions cli/src/effects.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions cli/src/error.rs
Original file line number Diff line number Diff line change
@@ -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<T> = ::std::result::Result<T, CliError>;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/account.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fmt::Render;
use super::Simple;
use fmt::Render;
use stellar_client::resources::Account;

impl Render<Account> for Simple {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/asset.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fmt::Render;
use super::Simple;
use fmt::Render;
use stellar_client::resources::Asset;

impl Render<Asset> for Simple {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/effect.rs
Original file line number Diff line number Diff line change
@@ -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<Effect> for Simple {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/ledger.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fmt::Render;
use super::Simple;
use fmt::Render;
use stellar_client::resources::Ledger;

impl Render<Ledger> for Simple {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/offer.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/orderbook.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fmt::Render;
use super::Simple;
use fmt::Render;
use stellar_client::resources::Orderbook;

impl Render<Orderbook> for Simple {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/payment.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fmt::Render;
use super::Simple;
use fmt::Render;
use stellar_client::resources::{Operation, OperationKind};

impl Render<Operation> for Simple {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/trade_aggregation.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fmt::Render;
use super::Simple;
use fmt::Render;
use stellar_client::resources::TradeAggregation;

impl Render<TradeAggregation> for Simple {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/fmt/simple/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fmt::Render;
use super::Simple;
use fmt::Render;
use stellar_client::resources::Transaction;

impl Render<Transaction> for Simple {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/ledgers.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
12 changes: 4 additions & 8 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions cli/src/operations.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
4 changes: 2 additions & 2 deletions cli/src/payments.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion cli/src/resolution.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/trades.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::{cursor, ordering, pager::Pager};
use asset_identifier;
use chrono::{DateTime, Utc};
use clap::ArgMatches;
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);
Expand Down
4 changes: 2 additions & 2 deletions cli/src/transactions.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
6 changes: 3 additions & 3 deletions client/src/client/async.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
6 changes: 3 additions & 3 deletions client/src/client/sync/iter.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 4 additions & 4 deletions client/src/client/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions client/src/endpoint/account.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions client/src/endpoint/asset.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion client/src/endpoint/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ macro_rules! impl_cursor {
self.cursor.as_ref().map(|s| &**s)
}
}
}
};
}

#[cfg(test)]
Expand Down
8 changes: 4 additions & 4 deletions client/src/endpoint/effect.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions client/src/endpoint/ledger.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion client/src/endpoint/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ macro_rules! impl_limit {
self.limit
}
}
}
};
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions client/src/endpoint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions client/src/endpoint/operation.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion client/src/endpoint/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ macro_rules! impl_order {
self.order
}
}
}
};
}

/// The order to return results in.
Expand Down
6 changes: 3 additions & 3 deletions client/src/endpoint/orderbook.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 4 additions & 4 deletions client/src/endpoint/payment.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Loading

0 comments on commit 652da82

Please sign in to comment.