mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +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
@@ -176,7 +176,7 @@ benchmarks_instance_pallet! {
|
||||
let witness = Class::<T, I>::get(class).unwrap().destroy_witness();
|
||||
}: _(SystemOrigin::Signed(caller), class, witness)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Destroyed { class: class }.into());
|
||||
assert_last_event::<T, I>(Event::Destroyed { class }.into());
|
||||
}
|
||||
|
||||
mint {
|
||||
@@ -216,7 +216,7 @@ benchmarks_instance_pallet! {
|
||||
caller_lookup.clone(),
|
||||
caller_lookup.clone(),
|
||||
caller_lookup.clone(),
|
||||
caller_lookup.clone(),
|
||||
caller_lookup,
|
||||
true,
|
||||
false,
|
||||
)?;
|
||||
@@ -268,7 +268,7 @@ benchmarks_instance_pallet! {
|
||||
let target_lookup = T::Lookup::unlookup(target.clone());
|
||||
T::Currency::make_free_balance_be(&target, T::Currency::minimum_balance());
|
||||
let origin = SystemOrigin::Signed(target.clone()).into();
|
||||
Uniques::<T, I>::set_accept_ownership(origin, Some(class.clone()))?;
|
||||
Uniques::<T, I>::set_accept_ownership(origin, Some(class))?;
|
||||
}: _(SystemOrigin::Signed(caller), class, target_lookup)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::OwnerChanged { class, new_owner: target }.into());
|
||||
@@ -279,7 +279,7 @@ benchmarks_instance_pallet! {
|
||||
let target0 = T::Lookup::unlookup(account("target", 0, SEED));
|
||||
let target1 = T::Lookup::unlookup(account("target", 1, SEED));
|
||||
let target2 = T::Lookup::unlookup(account("target", 2, SEED));
|
||||
}: _(SystemOrigin::Signed(caller), class, target0.clone(), target1.clone(), target2.clone())
|
||||
}: _(SystemOrigin::Signed(caller), class, target0, target1, target2)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::TeamChanged{
|
||||
class,
|
||||
@@ -297,7 +297,7 @@ benchmarks_instance_pallet! {
|
||||
owner: caller_lookup.clone(),
|
||||
issuer: caller_lookup.clone(),
|
||||
admin: caller_lookup.clone(),
|
||||
freezer: caller_lookup.clone(),
|
||||
freezer: caller_lookup,
|
||||
free_holding: true,
|
||||
is_frozen: false,
|
||||
};
|
||||
@@ -390,7 +390,7 @@ benchmarks_instance_pallet! {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, DepositBalanceOf::<T, I>::max_value());
|
||||
let class = T::Helper::class(0);
|
||||
}: _(SystemOrigin::Signed(caller.clone()), Some(class.clone()))
|
||||
}: _(SystemOrigin::Signed(caller.clone()), Some(class))
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::OwnershipAcceptanceChanged {
|
||||
who: caller,
|
||||
|
||||
@@ -73,7 +73,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
owner: owner.clone(),
|
||||
issuer: admin.clone(),
|
||||
admin: admin.clone(),
|
||||
freezer: admin.clone(),
|
||||
freezer: admin,
|
||||
total_deposit: deposit,
|
||||
free_holding,
|
||||
instances: 0,
|
||||
@@ -135,7 +135,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
Class::<T, I>::try_mutate(&class, |maybe_class_details| -> DispatchResult {
|
||||
let class_details = maybe_class_details.as_mut().ok_or(Error::<T, I>::UnknownClass)?;
|
||||
|
||||
with_details(&class_details)?;
|
||||
with_details(class_details)?;
|
||||
|
||||
let instances =
|
||||
class_details.instances.checked_add(1).ok_or(ArithmeticError::Overflow)?;
|
||||
@@ -171,7 +171,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
maybe_class_details.as_mut().ok_or(Error::<T, I>::UnknownClass)?;
|
||||
let details =
|
||||
Asset::<T, I>::get(&class, &instance).ok_or(Error::<T, I>::UnknownClass)?;
|
||||
with_details(&class_details, &details)?;
|
||||
with_details(class_details, &details)?;
|
||||
|
||||
// Return the deposit.
|
||||
T::Currency::unreserve(&class_details.owner, details.deposit);
|
||||
|
||||
@@ -93,12 +93,12 @@ impl<T: Config<I>, I: 'static> Create<<T as SystemConfig>::AccountId> for Pallet
|
||||
admin: &T::AccountId,
|
||||
) -> DispatchResult {
|
||||
Self::do_create_class(
|
||||
class.clone(),
|
||||
*class,
|
||||
who.clone(),
|
||||
admin.clone(),
|
||||
T::ClassDeposit::get(),
|
||||
false,
|
||||
Event::Created { class: class.clone(), creator: who.clone(), owner: admin.clone() },
|
||||
Event::Created { class: *class, creator: who.clone(), owner: admin.clone() },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ impl<T: Config<I>, I: 'static> Mutate<<T as SystemConfig>::AccountId> for Pallet
|
||||
instance: &Self::InstanceId,
|
||||
who: &T::AccountId,
|
||||
) -> DispatchResult {
|
||||
Self::do_mint(class.clone(), instance.clone(), who.clone(), |_| Ok(()))
|
||||
Self::do_mint(*class, *instance, who.clone(), |_| Ok(()))
|
||||
}
|
||||
|
||||
fn burn(
|
||||
@@ -133,10 +133,10 @@ impl<T: Config<I>, I: 'static> Mutate<<T as SystemConfig>::AccountId> for Pallet
|
||||
instance: &Self::InstanceId,
|
||||
maybe_check_owner: Option<&T::AccountId>,
|
||||
) -> DispatchResult {
|
||||
Self::do_burn(class.clone(), instance.clone(), |_, d| {
|
||||
Self::do_burn(*class, *instance, |_, d| {
|
||||
if let Some(check_owner) = maybe_check_owner {
|
||||
if &d.owner != check_owner {
|
||||
Err(Error::<T, I>::NoPermission)?;
|
||||
return Err(Error::<T, I>::NoPermission.into())
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -150,7 +150,7 @@ impl<T: Config<I>, I: 'static> Transfer<T::AccountId> for Pallet<T, I> {
|
||||
instance: &Self::InstanceId,
|
||||
destination: &T::AccountId,
|
||||
) -> DispatchResult {
|
||||
Self::do_transfer(class.clone(), instance.clone(), destination.clone(), |_, _| Ok(()))
|
||||
Self::do_transfer(*class, *instance, destination.clone(), |_, _| Ok(()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -720,7 +720,7 @@ pub mod pallet {
|
||||
|
||||
Class::<T, I>::try_mutate(class, |maybe_details| {
|
||||
let details = maybe_details.as_mut().ok_or(Error::<T, I>::UnknownClass)?;
|
||||
ensure!(&origin == &details.freezer, Error::<T, I>::NoPermission);
|
||||
ensure!(origin == details.freezer, Error::<T, I>::NoPermission);
|
||||
|
||||
details.is_frozen = true;
|
||||
|
||||
@@ -744,7 +744,7 @@ pub mod pallet {
|
||||
|
||||
Class::<T, I>::try_mutate(class, |maybe_details| {
|
||||
let details = maybe_details.as_mut().ok_or(Error::<T, I>::UnknownClass)?;
|
||||
ensure!(&origin == &details.admin, Error::<T, I>::NoPermission);
|
||||
ensure!(origin == details.admin, Error::<T, I>::NoPermission);
|
||||
|
||||
details.is_frozen = false;
|
||||
|
||||
@@ -778,7 +778,7 @@ pub mod pallet {
|
||||
|
||||
Class::<T, I>::try_mutate(class, |maybe_details| {
|
||||
let details = maybe_details.as_mut().ok_or(Error::<T, I>::UnknownClass)?;
|
||||
ensure!(&origin == &details.owner, Error::<T, I>::NoPermission);
|
||||
ensure!(origin == details.owner, Error::<T, I>::NoPermission);
|
||||
if details.owner == owner {
|
||||
return Ok(())
|
||||
}
|
||||
@@ -827,7 +827,7 @@ pub mod pallet {
|
||||
|
||||
Class::<T, I>::try_mutate(class, |maybe_details| {
|
||||
let details = maybe_details.as_mut().ok_or(Error::<T, I>::UnknownClass)?;
|
||||
ensure!(&origin == &details.owner, Error::<T, I>::NoPermission);
|
||||
ensure!(origin == details.owner, Error::<T, I>::NoPermission);
|
||||
|
||||
details.issuer = issuer.clone();
|
||||
details.admin = admin.clone();
|
||||
@@ -867,7 +867,7 @@ pub mod pallet {
|
||||
Asset::<T, I>::get(&class, &instance).ok_or(Error::<T, I>::UnknownClass)?;
|
||||
|
||||
if let Some(check) = maybe_check {
|
||||
let permitted = &check == &class_details.admin || &check == &details.owner;
|
||||
let permitted = check == class_details.admin || check == details.owner;
|
||||
ensure!(permitted, Error::<T, I>::NoPermission);
|
||||
}
|
||||
|
||||
@@ -916,7 +916,7 @@ pub mod pallet {
|
||||
let mut details =
|
||||
Asset::<T, I>::get(&class, &instance).ok_or(Error::<T, I>::UnknownClass)?;
|
||||
if let Some(check) = maybe_check {
|
||||
let permitted = &check == &class_details.admin || &check == &details.owner;
|
||||
let permitted = check == class_details.admin || check == details.owner;
|
||||
ensure!(permitted, Error::<T, I>::NoPermission);
|
||||
}
|
||||
let maybe_check_delegate = maybe_check_delegate.map(T::Lookup::lookup).transpose()?;
|
||||
|
||||
Reference in New Issue
Block a user