Fix clippy suggestions. (#179)

* Fix clippy errors.

* Cargo fmt.

* Enable clippy checks.

* Create if does not exist.

* Fix warnings and enable sccache for clippy.

* chmod +x

* Revert and ignore errors.

* Update cancel-workflow-action.

* Fixes.

* Clippy fixes.

* Fix compilation.

* Fix new clippy warnings.

* fmt --all

* Fix the rest.

* fmt --all

* Conditional.

* Bump smallvec.

* Use separate cache dir for clippy to prevent races.

* Remove unused imports in tests

* Remove "useless conversion"

* Move clippy to main worfklow to avoid clashes.

* Fix clippy error.

* Fix remaning clippy errors.

* cargo fmt --all

Co-authored-by: Hernando Castano <castano.ha@gmail.com>
This commit is contained in:
Tomasz Drwięga
2020-07-20 19:17:32 +02:00
committed by Bastian Köcher
parent 65852944e3
commit bdf6901ce2
31 changed files with 159 additions and 197 deletions
+1 -5
View File
@@ -193,17 +193,13 @@ pub(crate) fn prepare_ethereum_transaction(
payload: recipient_raw.to_vec(),
};
editor(&mut eth_tx);
eth_tx.sign_by(&signer.into(), Some(chain_id))
eth_tx.sign_by(&signer, Some(chain_id))
}
#[cfg(test)]
mod tests {
use super::*;
use hex_literal::hex;
use sp_bridge_eth_poa::{
signatures::{SecretKey, SignTransaction},
UnsignedTransaction,
};
fn ferdie() -> crate::AccountId {
hex!("1cbd2d43530a44705ad088af313e18f80b53ef16b36177cd4b77b846f2a5f07c").into()
+3 -6
View File
@@ -108,12 +108,11 @@ pub fn genesis_header() -> Header {
gas_limit: 6000000.into(),
difficulty: 131072.into(),
seal: vec![
vec![128].into(),
vec![128],
vec![
184, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
]
.into(),
],
],
}
}
@@ -128,9 +127,7 @@ pub struct PruningStrategy;
impl BridgePruningStrategy for PruningStrategy {
fn pruning_upper_bound(&mut self, _best_number: u64, best_finalized_number: u64) -> u64 {
best_finalized_number
.checked_sub(FINALIZED_HEADERS_TO_KEEP)
.unwrap_or(0)
best_finalized_number.saturating_sub(FINALIZED_HEADERS_TO_KEEP)
}
}
+4
View File
@@ -19,6 +19,10 @@
#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
// Runtime-generated enums
#![allow(clippy::large_enum_variant)]
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
// Make the WASM binary available.
#[cfg(feature = "std")]
+3 -5
View File
@@ -82,10 +82,10 @@ pub fn genesis_header() -> Header {
gas_used: Default::default(),
gas_limit: 0x222222.into(),
difficulty: 0x20000.into(),
seal: vec![vec![0x80].into(), {
seal: vec![vec![0x80], {
let mut vec = vec![0xb8, 0x41];
vec.resize(67, 0);
vec.into()
vec
}],
}
}
@@ -100,9 +100,7 @@ pub struct PruningStrategy;
impl TPruningStrategy for PruningStrategy {
fn pruning_upper_bound(&mut self, _best_number: u64, best_finalized_number: u64) -> u64 {
best_finalized_number
.checked_sub(FINALIZED_HEADERS_TO_KEEP)
.unwrap_or(0)
best_finalized_number.saturating_sub(FINALIZED_HEADERS_TO_KEEP)
}
}