diff --git a/ipc/codegen/src/codegen.rs b/ipc/codegen/src/codegen.rs index 1744f9a9c..71083fb78 100644 --- a/ipc/codegen/src/codegen.rs +++ b/ipc/codegen/src/codegen.rs @@ -77,7 +77,7 @@ fn push_handshake_struct(cx: &ExtCtxt, push: &mut FnMut(Annotatable)) { pub struct BinHandshake { api_version: String, protocol_version: String, - _reserved: Vec, + reserved: Vec, } ).unwrap(); @@ -306,7 +306,7 @@ fn strip_ptr(ty: &P) -> P { } fn has_ptr(ty: &P) -> bool { - if let ast::TyKind::Rptr(_, ref ptr_mut) = ty.node { + if let ast::TyKind::Rptr(_, ref _ptr_mut) = ty.node { true } else { false } @@ -625,7 +625,7 @@ fn push_client_implementation( let payload = BinHandshake { protocol_version: $item_ident::protocol_version().to_string(), api_version: $item_ident::api_version().to_string(), - _reserved: vec![0u8; 64], + reserved: vec![0u8; 64], }; let mut socket_ref = self.socket.borrow_mut(); diff --git a/ipc/codegen/src/typegen.rs b/ipc/codegen/src/typegen.rs index e6e828ee7..1f4ef5b63 100644 --- a/ipc/codegen/src/typegen.rs +++ b/ipc/codegen/src/typegen.rs @@ -138,11 +138,11 @@ pub fn push_bin_box( let serialize_impl = quote_item!(cx, impl ::serde::ser::Serialize for $ident { - fn serialize<__S>(&self, _serializer: &mut __S) -> ::std::result::Result<(), __S::Error> + fn serialize<__S>(&self, serializer: &mut __S) -> ::std::result::Result<(), __S::Error> where __S: ::serde::ser::Serializer { let &$ident(ref val) = self; - _serializer.serialize_bytes(val.as_slice()) + serializer.serialize_bytes(val.as_slice()) } }).unwrap(); diff --git a/json/src/spec/engine.rs b/json/src/spec/engine.rs index 6b56d7b71..e5f5dc718 100644 --- a/json/src/spec/engine.rs +++ b/json/src/spec/engine.rs @@ -16,7 +16,7 @@ //! Engine deserialization. -use serde::{Deserializer, Error}; +use serde::Deserializer; use serde::de::Visitor; use spec::Ethash; diff --git a/miner/src/transaction_queue.rs b/miner/src/transaction_queue.rs index e9f2570e3..63b49f9f4 100644 --- a/miner/src/transaction_queue.rs +++ b/miner/src/transaction_queue.rs @@ -230,7 +230,7 @@ impl TransactionSet { by_hash.remove(&order.hash) .expect("Hash found in `by_priorty` matches the one dropped; so it is included in `by_hash`"); - let max = removed.get(&sender).map(|val| cmp::max(*val, nonce)).unwrap_or(nonce); + let max = removed.get(&sender).map_or(nonce, |val| cmp::max(*val, nonce)); removed.insert(sender, max); removed })) diff --git a/parity/hypervisor/mod.rs b/parity/hypervisor/mod.rs index bbc95b150..4b46a77c9 100644 --- a/parity/hypervisor/mod.rs +++ b/parity/hypervisor/mod.rs @@ -41,6 +41,12 @@ pub struct Hypervisor { processes: RwLock>, } +impl Default for Hypervisor { + fn default() -> Self { + Hypervisor::new() + } +} + impl Hypervisor { /// initializes the Hypervisor service with the open ipc socket for incoming clients pub fn new() -> Hypervisor { @@ -116,6 +122,7 @@ impl Hypervisor { } } +#[cfg(test)] mod tests { use super::*; use std::sync::atomic::{AtomicBool,Ordering}; diff --git a/parity/main.rs b/parity/main.rs index dff7ceaeb..8311e82ca 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -301,7 +301,7 @@ fn setup_log(init: &Option) -> Arc { } let logs = Arc::new(RotatingLogger::new(levels)); - let log2 = logs.clone(); + let logger = logs.clone(); let format = move |record: &LogRecord| { let timestamp = time::strftime("%Y-%m-%d %H:%M:%S %Z", &time::now()).unwrap(); let format = if max_log_level() <= LogLevelFilter::Info { @@ -309,7 +309,7 @@ fn setup_log(init: &Option) -> Arc { } else { format!("{}{}:{}: {}", timestamp, record.level(), record.target(), record.args()) }; - log2.append(format.clone()); + logger.append(format.clone()); format }; builder.format(format); diff --git a/parity/upgrade.rs b/parity/upgrade.rs index b74c17f64..30c977df4 100644 --- a/parity/upgrade.rs +++ b/parity/upgrade.rs @@ -21,6 +21,7 @@ use std::collections::*; use std::fs::{File, create_dir_all}; use std::env; use std::io::{Read, Write}; +use std::path::PathBuf; #[cfg_attr(feature="dev", allow(enum_variant_names))] #[derive(Debug)] @@ -99,7 +100,7 @@ fn with_locked_version(db_path: Option<&str>, script: F) -> Result, u16); + let tup = (vec![1u16, 1u16, 1u16, 1u16], 10u16); let bytes = vec![ // map @@ -507,8 +509,6 @@ fn raw_bytes_from_tuple() { // 10u16 10u8, 0u8]; - type Tup = (Vec, u16); - let tup_from = Tup::from_bytes(&bytes).unwrap(); assert_eq!(tup, tup_from);