mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 02:25:51 +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
@@ -83,7 +83,7 @@ pub trait Currency<AccountId> {
|
||||
/// This is just the same as burning and issuing the same amount and has no effect on the
|
||||
/// total issuance.
|
||||
fn pair(amount: Self::Balance) -> (Self::PositiveImbalance, Self::NegativeImbalance) {
|
||||
(Self::burn(amount.clone()), Self::issue(amount))
|
||||
(Self::burn(amount), Self::issue(amount))
|
||||
}
|
||||
|
||||
/// The 'free' balance of a given account.
|
||||
|
||||
@@ -92,7 +92,7 @@ pub trait Mutate<AccountId>: Inspect<AccountId> {
|
||||
let extra = Self::can_withdraw(&source, amount).into_result()?;
|
||||
// As we first burn and then mint, we don't need to check if `mint` fits into the supply.
|
||||
// If we can withdraw/burn it, we can also mint it again.
|
||||
Self::can_deposit(&dest, amount.saturating_add(extra), false).into_result()?;
|
||||
Self::can_deposit(dest, amount.saturating_add(extra), false).into_result()?;
|
||||
let actual = Self::burn_from(source, amount)?;
|
||||
debug_assert!(
|
||||
actual == amount.saturating_add(extra),
|
||||
|
||||
@@ -165,7 +165,7 @@ pub trait Unbalanced<AccountId>: Inspect<AccountId> {
|
||||
) -> Result<Self::Balance, DispatchError> {
|
||||
let old_balance = Self::balance(who);
|
||||
let (mut new_balance, mut amount) = if old_balance < amount {
|
||||
Err(TokenError::NoFunds)?
|
||||
return Err(TokenError::NoFunds.into())
|
||||
} else {
|
||||
(old_balance - amount, amount)
|
||||
};
|
||||
@@ -225,7 +225,7 @@ pub trait Unbalanced<AccountId>: Inspect<AccountId> {
|
||||
let old_balance = Self::balance(who);
|
||||
let new_balance = old_balance.checked_add(&amount).ok_or(ArithmeticError::Overflow)?;
|
||||
if new_balance < Self::minimum_balance() {
|
||||
Err(TokenError::BelowMinimum)?
|
||||
return Err(TokenError::BelowMinimum.into())
|
||||
}
|
||||
if old_balance != new_balance {
|
||||
Self::set_balance(who, new_balance)?;
|
||||
|
||||
@@ -145,7 +145,7 @@ pub trait Mutate<AccountId>: Inspect<AccountId> {
|
||||
let extra = Self::can_withdraw(asset, &source, amount).into_result()?;
|
||||
// As we first burn and then mint, we don't need to check if `mint` fits into the supply.
|
||||
// If we can withdraw/burn it, we can also mint it again.
|
||||
Self::can_deposit(asset, &dest, amount.saturating_add(extra), false).into_result()?;
|
||||
Self::can_deposit(asset, dest, amount.saturating_add(extra), false).into_result()?;
|
||||
let actual = Self::burn_from(asset, source, amount)?;
|
||||
debug_assert!(
|
||||
actual == amount.saturating_add(extra),
|
||||
|
||||
@@ -186,7 +186,7 @@ pub trait Unbalanced<AccountId>: Inspect<AccountId> {
|
||||
) -> Result<Self::Balance, DispatchError> {
|
||||
let old_balance = Self::balance(asset, who);
|
||||
let (mut new_balance, mut amount) = if old_balance < amount {
|
||||
Err(TokenError::NoFunds)?
|
||||
return Err(TokenError::NoFunds.into())
|
||||
} else {
|
||||
(old_balance - amount, amount)
|
||||
};
|
||||
@@ -251,7 +251,7 @@ pub trait Unbalanced<AccountId>: Inspect<AccountId> {
|
||||
let old_balance = Self::balance(asset, who);
|
||||
let new_balance = old_balance.checked_add(&amount).ok_or(ArithmeticError::Overflow)?;
|
||||
if new_balance < Self::minimum_balance(asset) {
|
||||
Err(TokenError::BelowMinimum)?
|
||||
return Err(TokenError::BelowMinimum.into())
|
||||
}
|
||||
if old_balance != new_balance {
|
||||
Self::set_balance(asset, who, new_balance)?;
|
||||
|
||||
Reference in New Issue
Block a user