mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 23:01:01 +00:00
Apply some clippy lints (#11154)
* Apply some clippy hints * Revert clippy ci changes * Update client/cli/src/commands/generate.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/cli/src/commands/inspect_key.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/db/src/bench.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/db/src/bench.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/service/src/client/block_rules.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/service/src/client/block_rules.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/network/src/transactions.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/network/src/protocol.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Revert due to missing `or_default` function. * Fix compilation and simplify code * Undo change that corrupts benchmark. * fix clippy * Update client/service/test/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/state-db/src/noncanonical.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update client/state-db/src/noncanonical.rs remove leftovers! * Update client/tracing/src/logging/directives.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update utils/fork-tree/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * added needed ref * Update frame/referenda/src/benchmarking.rs * Simplify byte-vec creation * let's just not overlap the ranges * Correction * cargo fmt * Update utils/frame/benchmarking-cli/src/shared/stats.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update utils/frame/benchmarking-cli/src/pallet/command.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update utils/frame/benchmarking-cli/src/pallet/command.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Giles Cope <gilescope@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a990473cf9
commit
b581604aa7
@@ -79,7 +79,7 @@ fn bench_hash_128_dyn_size(c: &mut Criterion) {
|
||||
fn bench_ed25519(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("ed25519");
|
||||
|
||||
for msg_size in vec![32, 1024, 1024 * 1024] {
|
||||
for &msg_size in &[32, 1024, 1024 * 1024] {
|
||||
let msg = (0..msg_size).map(|_| rand::random::<u8>()).collect::<Vec<_>>();
|
||||
let key = sp_core::ed25519::Pair::generate().0;
|
||||
group.bench_function(BenchmarkId::new("signing", format!("{}", msg_size)), |b| {
|
||||
@@ -87,7 +87,7 @@ fn bench_ed25519(c: &mut Criterion) {
|
||||
});
|
||||
}
|
||||
|
||||
for msg_size in vec![32, 1024, 1024 * 1024] {
|
||||
for &msg_size in &[32, 1024, 1024 * 1024] {
|
||||
let msg = (0..msg_size).map(|_| rand::random::<u8>()).collect::<Vec<_>>();
|
||||
let key = sp_core::ed25519::Pair::generate().0;
|
||||
let sig = key.sign(&msg);
|
||||
@@ -103,7 +103,7 @@ fn bench_ed25519(c: &mut Criterion) {
|
||||
fn bench_sr25519(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("sr25519");
|
||||
|
||||
for msg_size in vec![32, 1024, 1024 * 1024] {
|
||||
for &msg_size in &[32, 1024, 1024 * 1024] {
|
||||
let msg = (0..msg_size).map(|_| rand::random::<u8>()).collect::<Vec<_>>();
|
||||
let key = sp_core::sr25519::Pair::generate().0;
|
||||
group.bench_function(BenchmarkId::new("signing", format!("{}", msg_size)), |b| {
|
||||
@@ -111,7 +111,7 @@ fn bench_sr25519(c: &mut Criterion) {
|
||||
});
|
||||
}
|
||||
|
||||
for msg_size in vec![32, 1024, 1024 * 1024] {
|
||||
for &msg_size in &[32, 1024, 1024 * 1024] {
|
||||
let msg = (0..msg_size).map(|_| rand::random::<u8>()).collect::<Vec<_>>();
|
||||
let key = sp_core::sr25519::Pair::generate().0;
|
||||
let sig = key.sign(&msg);
|
||||
@@ -127,7 +127,7 @@ fn bench_sr25519(c: &mut Criterion) {
|
||||
fn bench_ecdsa(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("ecdsa");
|
||||
|
||||
for msg_size in vec![32, 1024, 1024 * 1024] {
|
||||
for &msg_size in &[32, 1024, 1024 * 1024] {
|
||||
let msg = (0..msg_size).map(|_| rand::random::<u8>()).collect::<Vec<_>>();
|
||||
let key = sp_core::ecdsa::Pair::generate().0;
|
||||
group.bench_function(BenchmarkId::new("signing", format!("{}", msg_size)), |b| {
|
||||
@@ -135,7 +135,7 @@ fn bench_ecdsa(c: &mut Criterion) {
|
||||
});
|
||||
}
|
||||
|
||||
for msg_size in vec![32, 1024, 1024 * 1024] {
|
||||
for &msg_size in &[32, 1024, 1024 * 1024] {
|
||||
let msg = (0..msg_size).map(|_| rand::random::<u8>()).collect::<Vec<_>>();
|
||||
let key = sp_core::ecdsa::Pair::generate().0;
|
||||
let sig = key.sign(&msg);
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(super) struct MultipleInputBytes(pub Vec<Vec<u8>>);
|
||||
|
||||
impl MultipleInputBytes {
|
||||
pub(super) fn concatenated(mut self) -> Vec<u8> {
|
||||
if self.0.len() == 0 {
|
||||
if self.0.is_empty() {
|
||||
Vec::new()
|
||||
} else {
|
||||
let mut result = core::mem::take(&mut self.0[0]);
|
||||
|
||||
@@ -1172,7 +1172,7 @@ mod tests {
|
||||
impl ByteArray for TestPublic {
|
||||
const LEN: usize = 0;
|
||||
fn from_slice(bytes: &[u8]) -> Result<Self, ()> {
|
||||
if bytes.len() == 0 {
|
||||
if bytes.is_empty() {
|
||||
Ok(Self)
|
||||
} else {
|
||||
Err(())
|
||||
|
||||
@@ -364,7 +364,7 @@ impl From<RecoverableSignature> for Signature {
|
||||
/// Derive a single hard junction.
|
||||
#[cfg(feature = "full_crypto")]
|
||||
fn derive_hard_junction(secret_seed: &Seed, cc: &[u8; 32]) -> Seed {
|
||||
("Secp256k1HDKD", secret_seed, cc).using_encoded(|data| sp_core_hashing::blake2_256(data))
|
||||
("Secp256k1HDKD", secret_seed, cc).using_encoded(sp_core_hashing::blake2_256)
|
||||
}
|
||||
|
||||
/// An error when deriving a key.
|
||||
@@ -763,12 +763,12 @@ mod test {
|
||||
set_default_ss58_version(Ss58AddressFormat::custom(200));
|
||||
// custom addr encoded by version 200
|
||||
let addr = "4pbsSkWcBaYoFHrKJZp5fDVUKbqSYD9dhZZGvpp3vQ5ysVs5ybV";
|
||||
Public::from_ss58check(&addr).unwrap();
|
||||
Public::from_ss58check(addr).unwrap();
|
||||
|
||||
set_default_ss58_version(default_format);
|
||||
// set current ss58 version to default version
|
||||
let addr = "KWAfgC2aRG5UVD6CpbPQXCx4YZZUhvWqqAJE6qcYc9Rtr6g5C";
|
||||
Public::from_ss58check(&addr).unwrap();
|
||||
Public::from_ss58check(addr).unwrap();
|
||||
|
||||
println!("CUSTOM_FORMAT_SUCCESSFUL");
|
||||
} else {
|
||||
|
||||
@@ -397,7 +397,7 @@ impl From<&Public> for CryptoTypePublicPair {
|
||||
/// Derive a single hard junction.
|
||||
#[cfg(feature = "full_crypto")]
|
||||
fn derive_hard_junction(secret_seed: &Seed, cc: &[u8; 32]) -> Seed {
|
||||
("Ed25519HDKD", secret_seed, cc).using_encoded(|data| sp_core_hashing::blake2_256(data))
|
||||
("Ed25519HDKD", secret_seed, cc).using_encoded(sp_core_hashing::blake2_256)
|
||||
}
|
||||
|
||||
/// An error when deriving a key.
|
||||
|
||||
@@ -69,13 +69,13 @@ impl AsBytesRef for &[u8] {
|
||||
|
||||
impl AsBytesRef for [u8] {
|
||||
fn as_bytes_ref(&self) -> &[u8] {
|
||||
&self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl AsBytesRef for sp_std::vec::Vec<u8> {
|
||||
fn as_bytes_ref(&self) -> &[u8] {
|
||||
&self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user