mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 13:57:58 +00:00
Clippy arithmetic new (#8282)
* optimize code * fix clippy replace = with += or %= * fix redundant closure found warning * redundant field names in struct initialization * fix clippy warning and optimize code * fix clippy warning * fix clippy warning * fix test error
This commit is contained in:
@@ -90,7 +90,7 @@ impl ChangesTrieConfiguration {
|
||||
return max_digest_interval;
|
||||
}
|
||||
|
||||
current_level = current_level - 1;
|
||||
current_level -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ impl ChangesTrieConfiguration {
|
||||
|
||||
digest_step = digest_interval;
|
||||
digest_interval = new_digest_interval;
|
||||
current_level = current_level + 1;
|
||||
current_level += 1;
|
||||
}
|
||||
|
||||
Some((
|
||||
|
||||
@@ -487,7 +487,7 @@ impl TraitPair for Pair {
|
||||
let message = secp256k1::Message::parse(&blake2_256(message.as_ref()));
|
||||
let sig: (_, _) = match sig.try_into() { Ok(x) => x, _ => return false };
|
||||
match secp256k1::recover(&message, &sig.0, &sig.1) {
|
||||
Ok(actual) => &pubkey.0[..] == &actual.serialize_compressed()[..],
|
||||
Ok(actual) => pubkey.0[..] == actual.serialize_compressed()[..],
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@@ -525,7 +525,7 @@ impl Pair {
|
||||
#[cfg(feature = "std")]
|
||||
pub fn from_legacy_string(s: &str, password_override: Option<&str>) -> Pair {
|
||||
Self::from_string(s, password_override).unwrap_or_else(|_| {
|
||||
let mut padded_seed: Seed = [' ' as u8; 32];
|
||||
let mut padded_seed: Seed = [b' '; 32];
|
||||
let len = s.len().min(32);
|
||||
padded_seed[..len].copy_from_slice(&s.as_bytes()[..len]);
|
||||
Self::from_seed(&padded_seed)
|
||||
|
||||
@@ -25,8 +25,6 @@ use sp_std::vec::Vec;
|
||||
use crate::{hash::H256, hash::H512};
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
use blake2_rfc;
|
||||
#[cfg(feature = "full_crypto")]
|
||||
use core::convert::TryFrom;
|
||||
#[cfg(feature = "full_crypto")]
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
//! unless you know what you're doing. Using `sp_io` will be more performant, since instead of
|
||||
//! computing the hash in WASM it delegates that computation to the host client.
|
||||
|
||||
use blake2_rfc;
|
||||
use sha2::{Digest, Sha256};
|
||||
use tiny_keccak::{Hasher, Keccak};
|
||||
use twox_hash;
|
||||
|
||||
/// Do a Blake2 512-bit hash and place result in `dest`.
|
||||
pub fn blake2_512_into(data: &[u8], dest: &mut [u8; 64]) {
|
||||
|
||||
@@ -30,7 +30,7 @@ pub mod storage;
|
||||
pub mod testing;
|
||||
|
||||
/// Local storage prefix used by the Offchain Worker API to
|
||||
pub const STORAGE_PREFIX : &'static [u8] = b"storage";
|
||||
pub const STORAGE_PREFIX : &[u8] = b"storage";
|
||||
|
||||
/// Offchain workers local storage.
|
||||
pub trait OffchainStorage: Clone + Send + Sync {
|
||||
|
||||
Reference in New Issue
Block a user