mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +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
@@ -82,7 +82,7 @@ where
|
||||
_info: &DispatchInfoOf<Self::Call>,
|
||||
_len: usize,
|
||||
) -> TransactionValidity {
|
||||
if who.using_encoded(|d| d.into_iter().all(|x| *x == 0)) {
|
||||
if who.using_encoded(|d| d.iter().all(|x| *x == 0)) {
|
||||
return Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner))
|
||||
}
|
||||
Ok(ValidTransaction::default())
|
||||
|
||||
@@ -188,7 +188,7 @@ where
|
||||
len: usize,
|
||||
) -> Result<(), TransactionValidityError> {
|
||||
if info.class == DispatchClass::Mandatory {
|
||||
Err(InvalidTransaction::MandatoryDispatch)?
|
||||
return Err(InvalidTransaction::MandatoryDispatch.into())
|
||||
}
|
||||
Self::do_pre_dispatch(info, len)
|
||||
}
|
||||
@@ -201,7 +201,7 @@ where
|
||||
len: usize,
|
||||
) -> TransactionValidity {
|
||||
if info.class == DispatchClass::Mandatory {
|
||||
Err(InvalidTransaction::MandatoryDispatch)?
|
||||
return Err(InvalidTransaction::MandatoryDispatch.into())
|
||||
}
|
||||
Self::do_validate(info, len)
|
||||
}
|
||||
@@ -234,7 +234,7 @@ where
|
||||
// extrinsics that result in error.
|
||||
if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) {
|
||||
log::error!(target: "runtime::system", "Bad mandatory: {:?}", e);
|
||||
Err(InvalidTransaction::BadMandatory)?
|
||||
return Err(InvalidTransaction::BadMandatory.into())
|
||||
}
|
||||
|
||||
let unspent = post_info.calc_unspent(info);
|
||||
|
||||
@@ -456,7 +456,7 @@ pub mod pallet {
|
||||
pub fn kill_storage(origin: OriginFor<T>, keys: Vec<Key>) -> DispatchResultWithPostInfo {
|
||||
ensure_root(origin)?;
|
||||
for key in &keys {
|
||||
storage::unhashed::kill(&key);
|
||||
storage::unhashed::kill(key);
|
||||
}
|
||||
Ok(().into())
|
||||
}
|
||||
@@ -833,7 +833,7 @@ impl<
|
||||
Some(account) => account.clone(),
|
||||
None => zero_account_id,
|
||||
};
|
||||
O::from(RawOrigin::Signed(first_member.clone()))
|
||||
O::from(RawOrigin::Signed(first_member))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1196,8 +1196,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
|
||||
let phase = ExecutionPhase::<T>::get().unwrap_or_default();
|
||||
let event =
|
||||
EventRecord { phase, event, topics: topics.iter().cloned().collect::<Vec<_>>() };
|
||||
let event = EventRecord { phase, event, topics: topics.to_vec() };
|
||||
|
||||
// Index of the to be added event.
|
||||
let event_idx = {
|
||||
@@ -1522,16 +1521,16 @@ impl<T: Config> Pallet<T> {
|
||||
/// of the old and new runtime has the same spec name and that the spec version is increasing.
|
||||
pub fn can_set_code(code: &[u8]) -> Result<(), sp_runtime::DispatchError> {
|
||||
let current_version = T::Version::get();
|
||||
let new_version = sp_io::misc::runtime_version(&code)
|
||||
let new_version = sp_io::misc::runtime_version(code)
|
||||
.and_then(|v| RuntimeVersion::decode(&mut &v[..]).ok())
|
||||
.ok_or_else(|| Error::<T>::FailedToExtractRuntimeVersion)?;
|
||||
.ok_or(Error::<T>::FailedToExtractRuntimeVersion)?;
|
||||
|
||||
if new_version.spec_name != current_version.spec_name {
|
||||
Err(Error::<T>::InvalidSpecName)?
|
||||
return Err(Error::<T>::InvalidSpecName.into())
|
||||
}
|
||||
|
||||
if new_version.spec_version <= current_version.spec_version {
|
||||
Err(Error::<T>::SpecVersionNeedsToIncrease)?
|
||||
return Err(Error::<T>::SpecVersionNeedsToIncrease.into())
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -217,7 +217,7 @@ impl BlockWeights {
|
||||
/// Verifies correctness of this `BlockWeights` object.
|
||||
pub fn validate(self) -> ValidationResult {
|
||||
fn or_max(w: Option<Weight>) -> Weight {
|
||||
w.unwrap_or_else(|| Weight::max_value())
|
||||
w.unwrap_or_else(Weight::max_value)
|
||||
}
|
||||
let mut error = ValidationErrors::default();
|
||||
|
||||
@@ -246,7 +246,7 @@ impl BlockWeights {
|
||||
);
|
||||
// Max extrinsic should not be 0
|
||||
error_assert!(
|
||||
weights.max_extrinsic.unwrap_or_else(|| Weight::max_value()) > 0,
|
||||
weights.max_extrinsic.unwrap_or_else(Weight::max_value) > 0,
|
||||
&mut error,
|
||||
"[{:?}] {:?} (max_extrinsic) must not be 0. Check base cost and average initialization cost.",
|
||||
class, weights.max_extrinsic,
|
||||
|
||||
@@ -89,7 +89,7 @@ frame_support::generate_storage_alias!(
|
||||
pub fn migrate_from_single_u8_to_triple_ref_count<T: V2ToV3>() -> Weight {
|
||||
let mut translated: usize = 0;
|
||||
<Account<T>>::translate::<(T::Index, u8, T::AccountData), _>(|_key, (nonce, rc, data)| {
|
||||
translated = translated + 1;
|
||||
translated += 1;
|
||||
Some(AccountInfo { nonce, consumers: rc as RefCount, providers: 1, sufficients: 0, data })
|
||||
});
|
||||
log::info!(
|
||||
@@ -107,7 +107,7 @@ pub fn migrate_from_single_to_triple_ref_count<T: V2ToV3>() -> Weight {
|
||||
let mut translated: usize = 0;
|
||||
<Account<T>>::translate::<(T::Index, RefCount, T::AccountData), _>(
|
||||
|_key, (nonce, consumers, data)| {
|
||||
translated = translated + 1;
|
||||
translated += 1;
|
||||
Some(AccountInfo { nonce, consumers, providers: 1, sufficients: 0, data })
|
||||
},
|
||||
);
|
||||
@@ -125,7 +125,7 @@ pub fn migrate_from_dual_to_triple_ref_count<T: V2ToV3>() -> Weight {
|
||||
let mut translated: usize = 0;
|
||||
<Account<T>>::translate::<(T::Index, RefCount, RefCount, T::AccountData), _>(
|
||||
|_key, (nonce, consumers, providers, data)| {
|
||||
translated = translated + 1;
|
||||
translated += 1;
|
||||
Some(AccountInfo { nonce, consumers, providers, sufficients: 0, data })
|
||||
},
|
||||
);
|
||||
|
||||
@@ -88,7 +88,7 @@ where
|
||||
call: <T as SendTransactionTypes<LocalCall>>::OverarchingCall,
|
||||
signature: Option<<T::Extrinsic as ExtrinsicT>::SignaturePayload>,
|
||||
) -> Result<(), ()> {
|
||||
let xt = T::Extrinsic::new(call.into(), signature).ok_or(())?;
|
||||
let xt = T::Extrinsic::new(call, signature).ok_or(())?;
|
||||
sp_io::offchain::submit_transaction(xt.encode())
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ impl<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>, X> Signer<T, C, X>
|
||||
keystore_accounts.map(|account| account.public).collect();
|
||||
|
||||
Box::new(
|
||||
keys.into_iter()
|
||||
keys.iter()
|
||||
.enumerate()
|
||||
.map(|(index, key)| {
|
||||
let account_id = key.clone().into_account();
|
||||
|
||||
Reference in New Issue
Block a user