diff --git a/ethcore/src/account.rs b/ethcore/src/account.rs index f2942a7e1..66cceda42 100644 --- a/ethcore/src/account.rs +++ b/ethcore/src/account.rs @@ -342,7 +342,6 @@ mod tests { #[test] fn new_account() { - use rustc_serialize::hex::ToHex; let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new()); assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"); @@ -354,7 +353,6 @@ mod tests { #[test] fn create_account() { - use rustc_serialize::hex::ToHex; let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new()); assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"); diff --git a/ethcore/src/basic_authority.rs b/ethcore/src/basic_authority.rs index e1dab7c17..d56cbb638 100644 --- a/ethcore/src/basic_authority.rs +++ b/ethcore/src/basic_authority.rs @@ -200,7 +200,6 @@ mod tests { use super::*; use common::*; use block::*; - use engine::*; use tests::helpers::*; use util::keys::{TestAccountProvider, TestAccount}; diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 11b13c0c1..e7a378483 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -299,7 +299,6 @@ mod tests { use common::*; use block::*; - use engine::*; use tests::helpers::*; use super::super::new_morden; diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index 4cc98ee2b..1f5712c54 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -51,7 +51,6 @@ pub fn new_morden() -> Spec { Spec::load(include_bytes!("../../res/ethereum/mord mod tests { use common::*; use state::*; - use engine::*; use super::*; use tests::helpers::*; diff --git a/ethcore/src/state.rs b/ethcore/src/state.rs index c44614550..391730a94 100644 --- a/ethcore/src/state.rs +++ b/ethcore/src/state.rs @@ -358,8 +358,6 @@ mod tests { use super::*; use util::common::*; -use util::trie::*; -use util::rlp::*; use account::*; use tests::helpers::*; use devtools::*; diff --git a/ethcore/src/trace/db.rs b/ethcore/src/trace/db.rs index 5c88ee52b..a69a1ca27 100644 --- a/ethcore/src/trace/db.rs +++ b/ethcore/src/trace/db.rs @@ -22,7 +22,7 @@ use std::sync::{RwLock, Arc}; use std::path::Path; use bloomchain::{Number, Config as BloomConfig}; use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup}; -use util::{FixedHash, H256, H264, Database, DBTransaction}; +use util::{H256, H264, Database, DBTransaction}; use header::BlockNumber; use trace::{BlockTraces, LocalizedTrace, Config, Switch, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras}; diff --git a/ethcore/src/types/ids.rs b/ethcore/src/types/ids.rs index 8fffcb8f7..3390f020e 100644 --- a/ethcore/src/types/ids.rs +++ b/ethcore/src/types/ids.rs @@ -19,7 +19,6 @@ use util::hash::H256; use header::BlockNumber; use ipc::binary::BinaryConvertError; -use ipc::binary::BinaryConvertable; use std::mem; use std::collections::VecDeque; diff --git a/ipc/codegen/src/codegen.rs b/ipc/codegen/src/codegen.rs index 6f16994b6..362257fcf 100644 --- a/ipc/codegen/src/codegen.rs +++ b/ipc/codegen/src/codegen.rs @@ -33,7 +33,6 @@ use syntax::ast::{ use syntax::ast; use syntax::codemap::Span; use syntax::ext::base::{Annotatable, ExtCtxt}; -use syntax::ext::build::AstBuilder; use syntax::ptr::P; pub struct Error; diff --git a/ipc/codegen/src/serialization.rs b/ipc/codegen/src/serialization.rs index e8f3d2cd8..8cd9ffdca 100644 --- a/ipc/codegen/src/serialization.rs +++ b/ipc/codegen/src/serialization.rs @@ -252,14 +252,14 @@ fn binary_expr_struct( map_stmts.push(quote_stmt!(cx, map[$field_index] = total;).unwrap()); if ::syntax::print::pprust::ty_to_string(&codegen::strip_ptr(&field.ty)) == "u8" { - map_stmts.push(quote_stmt!(cx, total = total + 1;).unwrap()); + map_stmts.push(quote_stmt!(cx, total += 1;).unwrap()); } else { map_stmts.push(quote_stmt!(cx, let size = match $field_type_ident_qualified::len_params() { 0 => mem::size_of::<$field_type_ident>(), _ => length_stack.pop_front().unwrap(), }).unwrap()); - map_stmts.push(quote_stmt!(cx, total = total + size;).unwrap()); + map_stmts.push(quote_stmt!(cx, total += size;).unwrap()); } }; diff --git a/miner/src/transaction_queue.rs b/miner/src/transaction_queue.rs index 987dfde50..fc62c411e 100644 --- a/miner/src/transaction_queue.rs +++ b/miner/src/transaction_queue.rs @@ -535,12 +535,12 @@ impl TransactionQueue { /// Update height of all transactions in future transactions set. fn update_future(&mut self, sender: &Address, current_nonce: U256) { // We need to drain all transactions for current sender from future and reinsert them with updated height - let all_nonces_from_sender = match self.future.by_address.row(&sender) { + let all_nonces_from_sender = match self.future.by_address.row(sender) { Some(row_map) => row_map.keys().cloned().collect::>(), None => vec![], }; for k in all_nonces_from_sender { - let order = self.future.drop(&sender, &k).unwrap(); + let order = self.future.drop(sender, &k).unwrap(); if k >= current_nonce { self.future.insert(*sender, k, order.update_height(k, current_nonce)); } else { @@ -554,14 +554,14 @@ impl TransactionQueue { /// Drop all transactions from given sender from `current`. /// Either moves them to `future` or removes them from queue completely. fn move_all_to_future(&mut self, sender: &Address, current_nonce: U256) { - let all_nonces_from_sender = match self.current.by_address.row(&sender) { + let all_nonces_from_sender = match self.current.by_address.row(sender) { Some(row_map) => row_map.keys().cloned().collect::>(), None => vec![], }; for k in all_nonces_from_sender { // Goes to future or is removed - let order = self.current.drop(&sender, &k).unwrap(); + let order = self.current.drop(sender, &k).unwrap(); if k >= current_nonce { self.future.insert(*sender, k, order.update_height(k, current_nonce)); } else { @@ -803,7 +803,7 @@ mod test { fn new_tx() -> SignedTransaction { let keypair = KeyPair::create().unwrap(); - new_unsigned_tx(U256::from(123)).sign(&keypair.secret()) + new_unsigned_tx(U256::from(123)).sign(keypair.secret()) } @@ -1173,9 +1173,9 @@ mod test { let mut txq = TransactionQueue::new(); let kp = KeyPair::create().unwrap(); let secret = kp.secret(); - let tx = new_unsigned_tx(U256::from(123)).sign(&secret); - let tx1 = new_unsigned_tx(U256::from(124)).sign(&secret); - let tx2 = new_unsigned_tx(U256::from(125)).sign(&secret); + let tx = new_unsigned_tx(U256::from(123)).sign(secret); + let tx1 = new_unsigned_tx(U256::from(124)).sign(secret); + let tx2 = new_unsigned_tx(U256::from(125)).sign(secret); txq.add(tx, &default_nonce, TransactionOrigin::External).unwrap(); assert_eq!(txq.status().pending, 1); @@ -1403,11 +1403,11 @@ mod test { // given let mut txq = TransactionQueue::new(); let keypair = KeyPair::create().unwrap(); - let tx = new_unsigned_tx(U256::from(123)).sign(&keypair.secret()); + let tx = new_unsigned_tx(U256::from(123)).sign(keypair.secret()); let tx2 = { let mut tx2 = tx.deref().clone(); tx2.gas_price = U256::from(200); - tx2.sign(&keypair.secret()) + tx2.sign(keypair.secret()) }; // when @@ -1426,16 +1426,16 @@ mod test { // given let mut txq = TransactionQueue::new(); let keypair = KeyPair::create().unwrap(); - let tx0 = new_unsigned_tx(U256::from(123)).sign(&keypair.secret()); + let tx0 = new_unsigned_tx(U256::from(123)).sign(keypair.secret()); let tx1 = { let mut tx1 = tx0.deref().clone(); tx1.nonce = U256::from(124); - tx1.sign(&keypair.secret()) + tx1.sign(keypair.secret()) }; let tx2 = { let mut tx2 = tx1.deref().clone(); tx2.gas_price = U256::from(200); - tx2.sign(&keypair.secret()) + tx2.sign(keypair.secret()) }; // when diff --git a/parity/configuration.rs b/parity/configuration.rs index ba7789c08..92d69b068 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -171,7 +171,7 @@ impl Configuration { let (listen, public) = self.net_addresses(); ret.listen_address = listen; ret.public_address = public; - ret.use_secret = self.args.flag_node_key.as_ref().map(|s| Secret::from_str(&s).unwrap_or_else(|_| s.sha3())); + ret.use_secret = self.args.flag_node_key.as_ref().map(|s| Secret::from_str(s).unwrap_or_else(|_| s.sha3())); ret.discovery_enabled = !self.args.flag_no_discovery && !self.args.flag_nodiscover; ret.ideal_peers = self.max_peers(); let mut net_path = PathBuf::from(&self.path()); @@ -185,7 +185,7 @@ impl Configuration { let mut latest_era = None; let jdb_types = [journaldb::Algorithm::Archive, journaldb::Algorithm::EarlyMerge, journaldb::Algorithm::OverlayRecent, journaldb::Algorithm::RefCounted]; for i in jdb_types.into_iter() { - let db = journaldb::new(&append_path(&get_db_path(&Path::new(&self.path()), *i, spec.genesis_header().hash()), "state"), *i); + let db = journaldb::new(&append_path(&get_db_path(Path::new(&self.path()), *i, spec.genesis_header().hash()), "state"), *i); trace!(target: "parity", "Looking for best DB: {} at {:?}", i, db.latest_era()); match (latest_era, db.latest_era()) { (Some(best), Some(this)) if best >= this => {} @@ -251,7 +251,7 @@ impl Configuration { let account_service = AccountService::with_security(Path::new(&self.keys_path()), self.keys_iterations()); if let Some(ref unlocks) = self.args.flag_unlock { for d in unlocks.split(',') { - let a = Address::from_str(clean_0x(&d)).unwrap_or_else(|_| { + let a = Address::from_str(clean_0x(d)).unwrap_or_else(|_| { die!("{}: Invalid address for --unlock. Must be 40 hex characters, without the 0x at the beginning.", d) }); if passwords.iter().find(|p| account_service.unlock_account_no_expire(&a, p).is_ok()).is_none() { @@ -302,7 +302,7 @@ impl Configuration { pub fn directories(&self) -> Directories { let db_path = Configuration::replace_home( - &self.args.flag_datadir.as_ref().unwrap_or(&self.args.flag_db_path)); + self.args.flag_datadir.as_ref().unwrap_or(&self.args.flag_db_path)); ::std::fs::create_dir_all(&db_path).unwrap_or_else(|e| die_with_io_error("main", e)); let keys_path = Configuration::replace_home(&self.args.flag_keys_path); diff --git a/parity/hypervisor/service.rs.in b/parity/hypervisor/service.rs.in index a8ad90e12..12c39d90a 100644 --- a/parity/hypervisor/service.rs.in +++ b/parity/hypervisor/service.rs.in @@ -18,7 +18,6 @@ use std::sync::{RwLock,Arc}; use std::ops::*; use ipc::IpcConfig; use std::collections::HashMap; -use ipc::BinaryConvertable; use std::mem; use ipc::binary::BinaryConvertError; use std::collections::VecDeque; diff --git a/parity/main.rs b/parity/main.rs index dd70d39cc..862e3d336 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -138,7 +138,7 @@ fn execute_client(conf: Configuration) { // Build client let mut service = ClientService::start( - client_config, spec, net_settings, &Path::new(&conf.path()) + client_config, spec, net_settings, Path::new(&conf.path()) ).unwrap_or_else(|e| die_with_error("Client", e)); panic_handler.forward_from(&service); diff --git a/parity/price_info.rs b/parity/price_info.rs index 05b89d848..ad25f31da 100644 --- a/parity/price_info.rs +++ b/parity/price_info.rs @@ -37,7 +37,7 @@ impl PriceInfo { .and_then(|json| json.find_path(&["result", "ethusd"]) .and_then(|obj| match *obj { Json::String(ref s) => Some(PriceInfo { - ethusd: FromStr::from_str(&s).unwrap() + ethusd: FromStr::from_str(s).unwrap() }), _ => None })) diff --git a/parity/setup_log.rs b/parity/setup_log.rs index 75cd0f574..0fbc76fb3 100644 --- a/parity/setup_log.rs +++ b/parity/setup_log.rs @@ -31,7 +31,7 @@ pub fn setup_log(init: &Option) -> Arc { if env::var("RUST_LOG").is_ok() { let lvl = &env::var("RUST_LOG").unwrap(); - levels.push_str(&lvl); + levels.push_str(lvl); levels.push_str(","); builder.parse(lvl); } diff --git a/parity/upgrade.rs b/parity/upgrade.rs index 30c977df4..e976535b0 100644 --- a/parity/upgrade.rs +++ b/parity/upgrade.rs @@ -87,7 +87,7 @@ fn upgrade_from_version(previous_version: &Version) -> Result { if upgrade_key.is_applicable(previous_version, ¤t_version) { let upgrade_script = upgrades[upgrade_key]; try!(upgrade_script()); - count = count + 1; + count += 1; } } Ok(count) diff --git a/sync/src/chain.rs b/sync/src/chain.rs index bd94fb9be..6d7a76572 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -791,8 +791,8 @@ impl ChainSync { self.downloading_hashes.remove(&hash); } for b in &peer.asking_blocks { - self.downloading_headers.remove(&b); - self.downloading_bodies.remove(&b); + self.downloading_headers.remove(b); + self.downloading_bodies.remove(b); } peer.asking_blocks.clear(); } @@ -1255,7 +1255,7 @@ impl ChainSync { self.send_packet(io, peer_id, NEW_BLOCK_PACKET, rlp); self.peers.get_mut(&peer_id).unwrap().latest_hash = chain_info.best_block_hash.clone(); self.peers.get_mut(&peer_id).unwrap().latest_number = Some(chain_info.best_block_number); - sent = sent + 1; + sent += 1; } sent } @@ -1271,7 +1271,7 @@ impl ChainSync { // If we think peer is too far behind just send one latest hash peer_best = last_parent.clone(); } - sent = sent + match ChainSync::create_new_hashes_rlp(io.chain(), &peer_best, &chain_info.best_block_hash) { + sent += match ChainSync::create_new_hashes_rlp(io.chain(), &peer_best, &chain_info.best_block_hash) { Some(rlp) => { { let peer = self.peers.get_mut(&peer_id).unwrap(); @@ -1668,7 +1668,7 @@ mod tests { sync.propagate_new_hashes(&chain_info, &mut io); let data = &io.queue[0].data.clone(); - let result = sync.on_peer_new_hashes(&mut io, 0, &UntrustedRlp::new(&data)); + let result = sync.on_peer_new_hashes(&mut io, 0, &UntrustedRlp::new(data)); assert!(result.is_ok()); } @@ -1686,7 +1686,7 @@ mod tests { sync.propagate_blocks(&chain_info, &mut io); let data = &io.queue[0].data.clone(); - let result = sync.on_peer_new_block(&mut io, 0, &UntrustedRlp::new(&data)); + let result = sync.on_peer_new_block(&mut io, 0, &UntrustedRlp::new(data)); assert!(result.is_ok()); } diff --git a/sync/src/range_collection.rs b/sync/src/range_collection.rs index 0628df401..6b57f0a4b 100644 --- a/sync/src/range_collection.rs +++ b/sync/src/range_collection.rs @@ -70,7 +70,7 @@ impl<'c, K:'c, V:'c> Iterator for RangeIterator<'c, K, V> where K: Add { - Some((*k, &vec)) + Some((*k, vec)) }, None => None } diff --git a/sync/src/tests/chain.rs b/sync/src/tests/chain.rs index eebbdb164..4ed25325b 100644 --- a/sync/src/tests/chain.rs +++ b/sync/src/tests/chain.rs @@ -16,7 +16,6 @@ use util::*; use ethcore::client::{BlockChainClient, BlockId, EachBlockWith}; -use io::SyncIo; use chain::{SyncState}; use super::helpers::*; diff --git a/sync/src/tests/helpers.rs b/sync/src/tests/helpers.rs index 269362064..41eadf716 100644 --- a/sync/src/tests/helpers.rs +++ b/sync/src/tests/helpers.rs @@ -147,7 +147,7 @@ impl TestNet { let mut total_steps = 0; while !self.done() { self.sync_step(); - total_steps = total_steps + 1; + total_steps += 1; } total_steps } diff --git a/webapp/src/router/redirect.rs b/webapp/src/router/redirect.rs index f308635cd..6faf9d0c8 100644 --- a/webapp/src/router/redirect.rs +++ b/webapp/src/router/redirect.rs @@ -16,7 +16,6 @@ //! HTTP Redirection hyper handler -use std::io::Write; use hyper::{header, server, Decoder, Encoder, Next}; use hyper::net::HttpStream; use hyper::status::StatusCode;