Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
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
31 changes: 23 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ daemonize = "0.2"
num_cpus = "0.2"
number_prefix = "0.2"
rpassword = "0.2.1"
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
ethcore = { path = "ethcore" }
ethcore-util = { path = "util" }
ethsync = { path = "sync" }
Expand Down
2 changes: 1 addition & 1 deletion dapps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ parity-dapps-wallet = { git = "https://github.com/ethcore/parity-dapps-wallet-rs
parity-dapps-dao = { git = "https://github.com/ethcore/parity-dapps-dao-rs.git", version = "0.3.0", optional = true }
parity-dapps-makerotc = { git = "https://github.com/ethcore/parity-dapps-makerotc-rs.git", version = "0.2.0", optional = true }
mime_guess = { version = "1.6.1" }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}

[build-dependencies]
serde_codegen = { version = "0.7.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ethcore-util = { path = "../util" }
evmjit = { path = "../evmjit", optional = true }
ethash = { path = "../ethash" }
num_cpus = "0.2"
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
crossbeam = "0.2.9"
lazy_static = "0.1"
ethcore-devtools = { path = "../devtools" }
Expand Down
1 change: 0 additions & 1 deletion ethcore/src/evm/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
///! Rust VM implementation

use common::*;
use trace::VMTracer;
use super::instructions as instructions;
use super::instructions::{Instruction, get_info};
use std::marker::Copy;
Expand Down
14 changes: 7 additions & 7 deletions ethcore/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ impl<'a> Executive<'a> {
}

/// Creates `Externalities` from `Executive`.
pub fn as_externalities<'_, T, V>(
&'_ mut self,
pub fn as_externalities<'any, T, V>(
&'any mut self,
origin_info: OriginInfo,
substate: &'_ mut Substate,
output: OutputPolicy<'_, '_>,
tracer: &'_ mut T,
vm_tracer: &'_ mut V
) -> Externalities<'_, T, V> where T: Tracer, V: VMTracer {
substate: &'any mut Substate,
output: OutputPolicy<'any, 'any>,
tracer: &'any mut T,
vm_tracer: &'any mut V
) -> Externalities<'any, T, V> where T: Tracer, V: VMTracer {
Externalities::new(self.state, self.info, self.engine, self.vm_factory, self.depth, origin_info, substate, output, tracer, vm_tracer)
}

Expand Down
6 changes: 3 additions & 3 deletions ethcore/src/trace/executive_tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl VMTracer for ExecutiveVMTracer {
self.data.operations.push(VMOperation {
pc: pc,
instruction: instruction,
gas_cost: gas_cost.clone(),
gas_cost: gas_cost.clone(),
executed: None,
});
true
Expand All @@ -133,10 +133,10 @@ impl VMTracer for ExecutiveVMTracer {
self.data.operations.last_mut().expect("trace_executed is always called after a trace_prepare_execute").executed = Some(ex);
}

fn prepare_subtrace(&self, code: &Bytes) -> Self {
fn prepare_subtrace(&self, code: &[u8]) -> Self {
ExecutiveVMTracer { data: VMTrace {
parent_step: self.data.operations.len(),
code: code.clone(),
code: code.to_vec(),
operations: vec![],
subs: vec![],
}}
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub trait VMTracer: Send {
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem_diff: Option<(usize, &[u8])>, _store_diff: Option<(U256, U256)>) {}

/// Spawn subtracer which will be used to trace deeper levels of execution.
fn prepare_subtrace(&self, code: &Bytes) -> Self where Self: Sized;
fn prepare_subtrace(&self, code: &[u8]) -> Self where Self: Sized;

/// Spawn subtracer which will be used to trace deeper levels of execution.
fn done_subtrace(&mut self, sub: Self) where Self: Sized;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/trace/noop_tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl VMTracer for NoopVMTracer {
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem_diff: Option<(usize, &[u8])>, _store_diff: Option<(U256, U256)>) {}

/// Spawn subtracer which will be used to trace deeper levels of execution.
fn prepare_subtrace(&self, _code: &Bytes) -> Self { NoopVMTracer }
fn prepare_subtrace(&self, _code: &[u8]) -> Self { NoopVMTracer }

/// Spawn subtracer which will be used to trace deeper levels of execution.
fn done_subtrace(&mut self, _sub: Self) {}
Expand Down
2 changes: 1 addition & 1 deletion json/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rustc-serialize = "0.3"
serde = "0.7.0"
serde_json = "0.7.0"
serde_macros = { version = "0.7.0", optional = true }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}

[build-dependencies]
serde_codegen = { version = "0.7.0", optional = true }
Expand Down
1 change: 0 additions & 1 deletion parity/hypervisor/service.rs.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use std::sync::{RwLock,Arc};
use std::ops::*;
use ipc::IpcConfig;
use std::collections::HashMap;
use std::mem;
Expand Down
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ethcore-devtools = { path = "../devtools" }
rustc-serialize = "0.3"
transient-hashmap = "0.1"
serde_macros = { version = "0.7.0", optional = true }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ws = "0.4.7"
ethcore-util = { path = "../util" }
ethcore-rpc = { path = "../rpc" }

clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}

[features]
dev = ["clippy"]
2 changes: 1 addition & 1 deletion sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = ["Ethcore <[email protected]"]
[dependencies]
ethcore-util = { path = "../util" }
ethcore = { path = "../ethcore" }
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
log = "0.3"
env_logger = "0.3"
time = "0.1.34"
Expand Down
19 changes: 10 additions & 9 deletions sync/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ impl ChainSync {
let skip: usize = try!(r.val_at(2));
let reverse: bool = try!(r.val_at(3));
let last = io.chain().chain_info().best_block_number;
let mut number = if try!(r.at(0)).size() == 32 {
let number = if try!(r.at(0)).size() == 32 {
// id is a hash
let hash: H256 = try!(r.val_at(0));
trace!(target: "sync", "-> GetBlockHeaders (hash: {}, max: {}, skip: {}, reverse:{})", hash, max_headers, skip, reverse);
Expand All @@ -931,11 +931,11 @@ impl ChainSync {
try!(r.val_at(0))
};

if reverse {
number = min(last, number);
let mut number = if reverse {
min(last, number)
} else {
number = max(0, number);
}
max(0, number)
};
let max_count = min(MAX_HEADERS_TO_SEND, max_headers);
let mut count = 0;
let mut data = Bytes::new();
Expand Down Expand Up @@ -1188,11 +1188,12 @@ impl ChainSync {
let mut sent = 0;
let last_parent = HeaderView::new(&io.chain().block_header(BlockID::Hash(chain_info.best_block_hash.clone())).unwrap()).parent_hash();
for (peer_id, peer_number) in lucky_peers {
let mut peer_best = self.peers.get(&peer_id).unwrap().latest_hash.clone();
if chain_info.best_block_number - peer_number > MAX_PEER_LAG_PROPAGATION as BlockNumber {
let peer_best = if chain_info.best_block_number - peer_number > MAX_PEER_LAG_PROPAGATION as BlockNumber {
// If we think peer is too far behind just send one latest hash
peer_best = last_parent.clone();
}
last_parent.clone()
} else {
self.peers.get(&peer_id).unwrap().latest_hash.clone()
};
sent += match ChainSync::create_new_hashes_rlp(io.chain(), &peer_best, &chain_info.best_block_hash) {
Some(rlp) => {
{
Expand Down
1 change: 1 addition & 0 deletions sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ impl NetworkProtocolHandler<SyncMessage> for EthSync {
self.sync.write().unwrap().maintain_sync(&mut NetSyncIo::new(io, self.chain.deref()));
}

#[cfg_attr(feature="dev", allow(single_match))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess they want you to use "if let" instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it looks much better as is imho.

Copy link
Contributor

@rphmeier rphmeier Jun 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree, seems like that lint is too subjective

fn message(&self, io: &NetworkContext<SyncMessage>, message: &SyncMessage) {
match *message {
SyncMessage::NewChainBlocks { ref imported, ref invalid, ref enacted, ref retracted } => {
Expand Down
2 changes: 1 addition & 1 deletion util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ crossbeam = "0.2"
slab = "0.2"
sha3 = { path = "sha3" }
serde = "0.7.0"
clippy = { version = "0.0.69", optional = true}
clippy = { version = "0.0.71", optional = true}
json-tests = { path = "json-tests" }
igd = "0.4.2"
ethcore-devtools = { path = "../devtools" }
Expand Down
20 changes: 10 additions & 10 deletions util/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ macro_rules! impl_hash {
}
}

impl<'_> From<&'_ str> for $from {
fn from(s: &'_ str) -> $from {
impl<'a> From<&'a str> for $from {
fn from(s: &'a str) -> $from {
use std::str::FromStr;
if s.len() % 2 == 1 {
$from::from_str(&("0".to_owned() + &(clean_0x(s).to_owned()))[..]).unwrap_or_else(|_| $from::new())
Expand All @@ -524,8 +524,8 @@ impl From<U256> for H256 {
}
}

impl<'_> From<&'_ U256> for H256 {
fn from(value: &'_ U256) -> H256 {
impl<'a> From<&'a U256> for H256 {
fn from(value: &'a U256) -> H256 {
unsafe {
let mut ret: H256 = ::std::mem::uninitialized();
value.to_raw_bytes(&mut ret);
Expand All @@ -540,8 +540,8 @@ impl From<H256> for U256 {
}
}

impl<'_> From<&'_ H256> for U256 {
fn from(value: &'_ H256) -> U256 {
impl<'a> From<&'a H256> for U256 {
fn from(value: &'a H256) -> U256 {
U256::from(value.bytes())
}
}
Expand All @@ -566,8 +566,8 @@ impl From<H256> for H64 {
}
}
/*
impl<'_> From<&'_ H256> for Address {
fn from(value: &'_ H256) -> Address {
impl<'a> From<&'a H256> for Address {
fn from(value: &'a H256) -> Address {
unsafe {
let mut ret: Address = ::std::mem::uninitialized();
::std::ptr::copy(value.as_ptr().offset(12), ret.as_mut_ptr(), 20);
Expand All @@ -586,8 +586,8 @@ impl From<Address> for H256 {
}
}

impl<'_> From<&'_ Address> for H256 {
fn from(value: &'_ Address) -> H256 {
impl<'a> From<&'a Address> for H256 {
fn from(value: &'a Address) -> H256 {
unsafe {
let mut ret = H256::new();
::std::ptr::copy(value.as_ptr(), ret.as_mut_ptr().offset(12), 20);
Expand Down
9 changes: 5 additions & 4 deletions util/src/network/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,11 @@ impl Discovery {
}

pub fn update_registration<Host:Handler>(&self, event_loop: &mut EventLoop<Host>) -> Result<(), NetworkError> {
let mut registration = EventSet::readable();
if !self.send_queue.is_empty() {
registration = registration | EventSet::writable();
}
let registration = if !self.send_queue.is_empty() {
EventSet::readable() | EventSet::writable()
} else {
EventSet::readable()
};
event_loop.reregister(&self.udp_socket, Token(self.token), registration, PollOpt::edge()).expect("Error reregistering UDP socket");
Ok(())
}
Expand Down
Loading