Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Fixing clippy warnings. #982

Merged
merged 3 commits into from
Apr 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ echo "#!/bin/sh\n" > $FILE
# Exit on any error
echo "set -e" >> $FILE
# Run release build
echo "cargo build --release --features dev" >> $FILE
echo "cargo build --features dev" >> $FILE
# Build tests
echo "cargo test --no-run --features dev \\" >> $FILE
echo " -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethminer -p ethcore-webapp" >> $FILE
Expand Down
6 changes: 3 additions & 3 deletions ipc/codegen/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions ipc/codegen/src/typegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion json/src/spec/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//! Engine deserialization.

use serde::{Deserializer, Error};
use serde::Deserializer;
use serde::de::Visitor;
use spec::Ethash;

Expand Down
2 changes: 1 addition & 1 deletion miner/src/transaction_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}))
Expand Down
8 changes: 8 additions & 0 deletions parity/hypervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

// while not included in binary
#![allow(dead_code)]
#![cfg_attr(feature="dev", allow(used_underscore_binding))]

pub mod service;

Expand All @@ -41,6 +42,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 {
Expand Down Expand Up @@ -116,6 +123,7 @@ impl Hypervisor {
}
}

#[cfg(test)]
mod tests {
use super::*;
use std::sync::atomic::{AtomicBool,Ordering};
Expand Down
5 changes: 3 additions & 2 deletions parity/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#![cfg_attr(feature="dev", feature(plugin))]
#![cfg_attr(feature="dev", plugin(clippy))]
#![cfg_attr(feature="dev", allow(useless_format))]

extern crate docopt;
extern crate num_cpus;
extern crate rustc_serialize;
Expand Down Expand Up @@ -301,15 +302,15 @@ 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 {
format!("{}{}", timestamp, record.args())
} else {
format!("{}{}:{}: {}", timestamp, record.level(), record.target(), record.args())
};
log2.append(format.clone());
logger.append(format.clone());
format
};
builder.format(format);
Expand Down
3 changes: 2 additions & 1 deletion parity/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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");

Expand Down
1 change: 1 addition & 0 deletions rpc/src/v1/tests/ethcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions util/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down