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

Commit

Permalink
Bump clippy & Fix warnings (#2109)
Browse files Browse the repository at this point in the history
* Bump clippy

* Fixing warnings
  • Loading branch information
tomusdrw authored and arkpar committed Sep 16, 2016
1 parent 851b639 commit 7f7e748
Show file tree
Hide file tree
Showing 27 changed files with 125 additions and 122 deletions.
31 changes: 16 additions & 15 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 @@ -42,7 +42,7 @@ ethcore-logger = { path = "logger" }
rlp = { path = "util/rlp" }
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
ethcore-dapps = { path = "dapps", optional = true }
clippy = { version = "0.0.85", optional = true}
clippy = { version = "0.0.90", optional = true}
ethcore-stratum = { path = "stratum" }

[target.'cfg(windows)'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion dapps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ parity-dapps-status = { git = "https://github.com/ethcore/parity-ui.git", versio
parity-dapps-home = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4" }
parity-dapps-wallet = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4", optional = true }
mime_guess = { version = "1.6.1" }
clippy = { version = "0.0.85", optional = true}
clippy = { version = "0.0.90", optional = true}

[build-dependencies]
serde_codegen = { version = "0.8", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build = "build.rs"
ethcore-ipc-codegen = { path = "../ipc/codegen" }

[dependencies]
clippy = { version = "0.0.85", optional = true}
clippy = { version = "0.0.90", optional = true}
ethcore-devtools = { path = "../devtools" }
ethcore-ipc = { path = "../ipc/rpc" }
rocksdb = { git = "https://github.com/ethcore/rust-rocksdb" }
Expand Down
4 changes: 2 additions & 2 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ num_cpus = "0.2"
crossbeam = "0.2.9"
lazy_static = "0.2"
bloomchain = "0.1"
rayon = "0.3.1"
rayon = "0.4.2"
semver = "0.2"
bit-set = "0.4"
time = "0.1"
evmjit = { path = "../evmjit", optional = true }
clippy = { version = "0.0.85", optional = true}
clippy = { version = "0.0.90", optional = true}
ethash = { path = "../ethash" }
ethcore-util = { path = "../util" }
ethcore-io = { path = "../util/io" }
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl ClosedBlock {
}

/// Given an engine reference, reopen the `ClosedBlock` into an `OpenBlock`.
pub fn reopen<'a>(self, engine: &'a Engine) -> OpenBlock<'a> {
pub fn reopen(self, engine: &Engine) -> OpenBlock {
// revert rewards (i.e. set state back at last transaction's state).
let mut block = self.block;
block.state = self.unclosed_state;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/blockchain/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ mod tests {
let mut block_header = bc.block_header(&best_hash);

while !block_header.is_none() {
block_header = bc.block_header(&block_header.unwrap().parent_hash());
block_header = bc.block_header(block_header.unwrap().parent_hash());
}
assert!(bc.cache_size().blocks > 1024 * 1024);

Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/ethereum/ethash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Engine for Ethash {
let fields = block.fields_mut();

// Bestow block reward
fields.state.add_balance(&fields.header.author(), &(reward + reward / U256::from(32) * U256::from(fields.uncles.len())));
fields.state.add_balance(fields.header.author(), &(reward + reward / U256::from(32) * U256::from(fields.uncles.len())));

// Bestow uncle rewards
let current_number = fields.header.number();
Expand Down
4 changes: 3 additions & 1 deletion ethcore/src/miner/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ impl Miner {
self.sealing_work.lock().queue.peek_last_ref().map(|b| b.base().clone())
}

#[cfg_attr(feature="dev", allow(match_same_arms))]
/// Prepares new block for sealing including top transactions from queue.
fn prepare_block(&self, chain: &MiningBlockChainClient) -> (ClosedBlock, Option<H256>) {
{
Expand Down Expand Up @@ -369,7 +370,7 @@ impl Miner {

/// Attempts to perform internal sealing (one that does not require work) to return Ok(sealed),
/// Err(Some(block)) returns for unsuccesful sealing while Err(None) indicates misspecified engine.
fn seal_block_internally(&self, block: ClosedBlock) -> Result<SealedBlock, Option<ClosedBlock>> {
fn seal_block_internally(&self, block: ClosedBlock) -> Result<SealedBlock, Option<ClosedBlock>> {
trace!(target: "miner", "seal_block_internally: block has transaction - attempting internal seal.");
let s = self.engine.generate_seal(block.block(), match self.accounts {
Some(ref x) => Some(&**x),
Expand Down Expand Up @@ -672,6 +673,7 @@ impl MinerService for Miner {
results
}

#[cfg_attr(feature="dev", allow(collapsible_if))]
fn import_own_transaction(
&self,
chain: &MiningBlockChainClient,
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/miner/transaction_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ mod test {
new_tx_pair(default_nonce(), default_gas_price(), nonce_increment, gas_price_increment)
}

/// Returns two transactions with identical (sender, nonce) but different gas_price/hash.
/// Returns two transactions with identical (sender, nonce) but different gas price/hash.
fn new_similar_tx_pair() -> (SignedTransaction, SignedTransaction) {
new_tx_pair_default(0.into(), 1.into())
}
Expand Down
1 change: 1 addition & 0 deletions ethcore/src/snapshot/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl StateProducer {
}
}

#[cfg_attr(feature="dev", allow(let_and_return))]
/// Tick the state producer. This alters the state, writing new data into
/// the database.
pub fn tick<R: Rng>(&mut self, rng: &mut R, db: &mut HashDB) {
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl Spec {
let r = Rlp::new(&seal);
(0..self.seal_fields).map(|i| r.at(i).as_raw().to_vec()).collect()
});
return header;
header
}

/// Compose the genesis block for this chain.
Expand Down Expand Up @@ -278,7 +278,7 @@ mod tests {
// https://github.com/ethcore/parity/issues/1840
#[test]
fn test_load_empty() {
assert!(Spec::load(&vec![] as &[u8]).is_err());
assert!(Spec::load(&[] as &[u8]).is_err());
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,13 +1314,13 @@ fn storage_at_from_database() {
let temp = RandomTempPath::new();
let (root, db) = {
let mut state = get_temp_state_in(temp.as_path());
state.set_storage(&a, H256::from(&U256::from(01u64)), H256::from(&U256::from(69u64)));
state.set_storage(&a, H256::from(&U256::from(1u64)), H256::from(&U256::from(69u64)));
state.commit().unwrap();
state.drop()
};

let s = State::from_existing(db, root, U256::from(0u8), Default::default()).unwrap();
assert_eq!(s.storage_at(&a, &H256::from(&U256::from(01u64))), H256::from(&U256::from(69u64)));
assert_eq!(s.storage_at(&a, &H256::from(&U256::from(1u64))), H256::from(&U256::from(69u64)));
}

#[test]
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.8"
serde_json = "0.8"
serde_macros = { version = "0.8", optional = true }
clippy = { version = "0.0.85", optional = true}
clippy = { version = "0.0.90", optional = true}

[build-dependencies]
serde_codegen = { version = "0.8", optional = true }
Expand Down
8 changes: 3 additions & 5 deletions parity/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ pub fn payload<B: ipc::BinaryConvertable>() -> Result<B, BootError> {

let mut buffer = Vec::new();
try!(
io::stdin().read_to_end(&mut buffer)
.map_err(|io_err| BootError::ReadArgs(io_err))
io::stdin().read_to_end(&mut buffer).map_err(BootError::ReadArgs)
);

ipc::binary::deserialize::<B>(&buffer)
.map_err(|binary_error| BootError::DecodeArgs(binary_error))
ipc::binary::deserialize::<B>(&buffer).map_err(BootError::DecodeArgs)
}

pub fn register(hv_url: &str, control_url: &str, module_id: IpcModuleId) -> GuardedSocket<HypervisorServiceClient<NanoSocket>>{
Expand All @@ -73,7 +71,7 @@ pub fn register(hv_url: &str, control_url: &str, module_id: IpcModuleId) -> Guar
pub fn dependency<C: WithSocket<NanoSocket>>(url: &str)
-> Result<GuardedSocket<C>, BootError>
{
nanoipc::generic_client::<C>(url).map_err(|socket_err| BootError::DependencyConnect(socket_err))
nanoipc::generic_client::<C>(url).map_err(BootError::DependencyConnect)
}

pub fn main_thread() -> Arc<AtomicBool> {
Expand Down
8 changes: 2 additions & 6 deletions parity/cli/usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,10 @@ macro_rules! usage {
let result = rustc_serialize::Decodable::decode(&mut toml::Decoder::new(toml::Value::Table(value)));
match result {
Ok(config) => Ok(config),
Err(e) => {
return Err(e.into());
}
Err(e) => Err(e.into()),
}
},
None => {
return Err(ArgsError::Parsing(value_parser.errors));
},
None => Err(ArgsError::Parsing(value_parser.errors)),
}
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rlp = { path = "../util/rlp" }
rustc-serialize = "0.3"
transient-hashmap = "0.1"
serde_macros = { version = "0.8.0", optional = true }
clippy = { version = "0.0.85", optional = true}
clippy = { version = "0.0.90", optional = true}
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
ethcore-ipc = { path = "../ipc/rpc" }
time = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ethcore-rpc = { path = "../rpc" }
ethcore-devtools = { path = "../devtools" }
parity-dapps-signer = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4", optional = true}

clippy = { version = "0.0.85", optional = true}
clippy = { version = "0.0.90", optional = true}

[features]
dev = ["clippy"]
Expand Down
2 changes: 1 addition & 1 deletion signer/src/ws_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Server {
// Spawn a thread with event loop
let handle = thread::spawn(move || {
ph.catch_panic(move || {
match ws.listen(addr.clone()).map_err(ServerError::from) {
match ws.listen(addr).map_err(ServerError::from) {
Err(ServerError::IoError(io)) => die(format!(
"Signer: Could not start listening on specified address. Make sure that no other instance is running on Signer's port. Details: {:?}",
io
Expand Down
2 changes: 1 addition & 1 deletion sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ethcore-network = { path = "../util/network" }
ethcore-io = { path = "../util/io" }
ethcore = { path = "../ethcore" }
rlp = { path = "../util/rlp" }
clippy = { version = "0.0.85", optional = true}
clippy = { version = "0.0.90", optional = true}
log = "0.3"
env_logger = "0.3"
time = "0.1.34"
Expand Down
Loading

0 comments on commit 7f7e748

Please sign in to comment.