From 1dca17fdb45903a62a3704c4bcdaacc59c3bf7db Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Tue, 8 May 2018 18:59:01 -0600 Subject: [PATCH] cargo +nightly fmt --- src/bin/client-demo.rs | 2 +- src/bin/testnode.rs | 2 +- src/ecdsa.rs | 2 +- src/lib.rs | 2 +- src/thin_client.rs | 4 ++-- src/timing.rs | 2 +- src/tpu.rs | 16 ++++++++-------- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/bin/client-demo.rs b/src/bin/client-demo.rs index 82cd42b2c1..013e029300 100644 --- a/src/bin/client-demo.rs +++ b/src/bin/client-demo.rs @@ -10,9 +10,9 @@ use futures::Future; use getopts::Options; use isatty::stdin_isatty; use rayon::prelude::*; -use solana::thin_client::ThinClient; use solana::mint::MintDemo; use solana::signature::{KeyPair, KeyPairUtil}; +use solana::thin_client::ThinClient; use solana::transaction::Transaction; use std::env; use std::io::{stdin, Read}; diff --git a/src/bin/testnode.rs b/src/bin/testnode.rs index 736acb0179..cc4ad246ad 100644 --- a/src/bin/testnode.rs +++ b/src/bin/testnode.rs @@ -7,12 +7,12 @@ extern crate solana; use getopts::Options; use isatty::stdin_isatty; use solana::accountant::Accountant; -use solana::tpu::Tpu; use solana::crdt::ReplicatedData; use solana::entry::Entry; use solana::event::Event; use solana::historian::Historian; use solana::signature::{KeyPair, KeyPairUtil}; +use solana::tpu::Tpu; use std::env; use std::io::{stdin, stdout, Read}; use std::net::UdpSocket; diff --git a/src/ecdsa.rs b/src/ecdsa.rs index c029f1e1f9..4d7abbdbb4 100644 --- a/src/ecdsa.rs +++ b/src/ecdsa.rs @@ -130,11 +130,11 @@ pub fn ed25519_verify(batches: &Vec) -> Vec> { #[cfg(test)] mod tests { - use tpu::Request; use bincode::serialize; use ecdsa; use packet::{Packet, Packets, SharedPackets}; use std::sync::RwLock; + use tpu::Request; use transaction::test_tx; use transaction::Transaction; diff --git a/src/lib.rs b/src/lib.rs index 5c7568c54d..ab3fc2ff56 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,8 +19,8 @@ pub mod signature; pub mod streamer; pub mod thin_client; pub mod timing; -pub mod transaction; pub mod tpu; +pub mod transaction; extern crate bincode; extern crate byteorder; extern crate chrono; diff --git a/src/thin_client.rs b/src/thin_client.rs index 920081a4f6..3ae436ef8d 100644 --- a/src/thin_client.rs +++ b/src/thin_client.rs @@ -3,7 +3,6 @@ //! messages to the network directly. The binary encoding of its messages are //! unstable and may change in future releases. -use tpu::{Request, Response, Subscription}; use bincode::{deserialize, serialize}; use futures::future::{ok, FutureResult}; use hash::Hash; @@ -11,6 +10,7 @@ use signature::{KeyPair, PublicKey, Signature}; use std::collections::HashMap; use std::io; use std::net::{SocketAddr, UdpSocket}; +use tpu::{Request, Response, Subscription}; use transaction::Transaction; pub struct ThinClient { @@ -148,7 +148,6 @@ impl ThinClient { mod tests { use super::*; use accountant::Accountant; - use tpu::Tpu; use crdt::{Crdt, ReplicatedData}; use futures::Future; use historian::Historian; @@ -162,6 +161,7 @@ mod tests { use std::thread::sleep; use std::time::Duration; use std::time::Instant; + use tpu::Tpu; // TODO: Figure out why this test sometimes hangs on TravisCI. #[test] diff --git a/src/timing.rs b/src/timing.rs index 5c36fad805..0d3c383839 100644 --- a/src/timing.rs +++ b/src/timing.rs @@ -1,5 +1,5 @@ -use std::time::{SystemTime, UNIX_EPOCH}; use std::time::Duration; +use std::time::{SystemTime, UNIX_EPOCH}; pub fn duration_as_ms(d: &Duration) -> u64 { return (d.as_secs() * 1000) + (d.subsec_nanos() as u64 / 1_000_000); diff --git a/src/tpu.rs b/src/tpu.rs index 32142e6ed8..6da34e1332 100644 --- a/src/tpu.rs +++ b/src/tpu.rs @@ -11,6 +11,7 @@ use hash::Hash; use historian::Historian; use packet; use packet::{SharedBlob, SharedPackets, BLOB_SIZE}; +use rand::{thread_rng, Rng}; use rayon::prelude::*; use recorder::Signal; use result::Result; @@ -26,11 +27,10 @@ use std::sync::mpsc::{channel, Receiver, Sender, SyncSender}; use std::sync::{Arc, Mutex, RwLock}; use std::thread::{spawn, JoinHandle}; use std::time::Duration; -use streamer; -use transaction::Transaction; -use timing; use std::time::Instant; -use rand::{thread_rng, Rng}; +use streamer; +use timing; +use transaction::Transaction; pub struct Tpu { acc: Mutex, @@ -785,15 +785,13 @@ pub fn to_packets(r: &packet::PacketRecycler, reqs: Vec) -> Vec