Fixing warnings

This commit is contained in:
Tomasz Drwięga 2016-04-21 15:56:35 +02:00
parent 3c665f7640
commit c47d08e308
9 changed files with 21 additions and 12 deletions

View File

@ -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<u8>,
reserved: Vec<u8>,
}
).unwrap();
@ -306,7 +306,7 @@ fn strip_ptr(ty: &P<ast::Ty>) -> P<ast::Ty> {
}
fn has_ptr(ty: &P<ast::Ty>) -> 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();

View File

@ -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();

View File

@ -16,7 +16,7 @@
//! Engine deserialization.
use serde::{Deserializer, Error};
use serde::Deserializer;
use serde::de::Visitor;
use spec::Ethash;

View File

@ -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
}))

View File

@ -41,6 +41,12 @@ pub struct Hypervisor {
processes: RwLock<HashMap<BinaryId, Child>>,
}
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};

View File

@ -301,7 +301,7 @@ fn setup_log(init: &Option<String>) -> Arc<RotatingLogger> {
}
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<String>) -> Arc<RotatingLogger> {
} else {
format!("{}{}:{}: {}", timestamp, record.level(), record.target(), record.args())
};
log2.append(format.clone());
logger.append(format.clone());
format
};
builder.format(format);

View File

@ -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<F>(db_path: Option<&str>, script: F) -> Result<usize, Err
let mut path = env::home_dir().expect("Applications should have a home dir");
path.push(".parity");
path
}, |s| ::std::path::PathBuf::from(s));
}, PathBuf::from);
try!(create_dir_all(&path).map_err(|_| Error::CannotCreateConfigPath));
path.push("ver.lock");

View File

@ -156,6 +156,7 @@ fn rpc_ethcore_dev_logs_levels() {
assert_eq!(io.handle_request(request), Some(response.to_owned()));
}
#[test]
fn rpc_ethcore_set_transactions_limit() {
let miner = miner_service();
let ethcore = EthcoreClient::new(&miner, logger()).to_delegate();

View File

@ -495,6 +495,8 @@ fn populate_big_types() {
#[test]
fn raw_bytes_from_tuple() {
type Tup = (Vec<u16>, 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>, u16);
let tup_from = Tup::from_bytes(&bytes).unwrap();
assert_eq!(tup, tup_from);