mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 22:51:13 +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
@@ -196,7 +196,7 @@ pub mod pallet {
|
||||
/// # </weight>
|
||||
#[pallet::weight({
|
||||
let di = call.get_dispatch_info();
|
||||
(T::WeightInfo::proxy(T::MaxProxies::get().into())
|
||||
(T::WeightInfo::proxy(T::MaxProxies::get())
|
||||
.saturating_add(di.weight)
|
||||
// AccountData for inner call origin accountdata.
|
||||
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
|
||||
@@ -230,7 +230,7 @@ pub mod pallet {
|
||||
/// # <weight>
|
||||
/// Weight is a function of the number of proxies the user has (P).
|
||||
/// # </weight>
|
||||
#[pallet::weight(T::WeightInfo::add_proxy(T::MaxProxies::get().into()))]
|
||||
#[pallet::weight(T::WeightInfo::add_proxy(T::MaxProxies::get()))]
|
||||
pub fn add_proxy(
|
||||
origin: OriginFor<T>,
|
||||
delegate: T::AccountId,
|
||||
@@ -252,7 +252,7 @@ pub mod pallet {
|
||||
/// # <weight>
|
||||
/// Weight is a function of the number of proxies the user has (P).
|
||||
/// # </weight>
|
||||
#[pallet::weight(T::WeightInfo::remove_proxy(T::MaxProxies::get().into()))]
|
||||
#[pallet::weight(T::WeightInfo::remove_proxy(T::MaxProxies::get()))]
|
||||
pub fn remove_proxy(
|
||||
origin: OriginFor<T>,
|
||||
delegate: T::AccountId,
|
||||
@@ -273,7 +273,7 @@ pub mod pallet {
|
||||
/// # <weight>
|
||||
/// Weight is a function of the number of proxies the user has (P).
|
||||
/// # </weight>
|
||||
#[pallet::weight(T::WeightInfo::remove_proxies(T::MaxProxies::get().into()))]
|
||||
#[pallet::weight(T::WeightInfo::remove_proxies(T::MaxProxies::get()))]
|
||||
pub fn remove_proxies(origin: OriginFor<T>) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
let (_, old_deposit) = Proxies::<T>::take(&who);
|
||||
@@ -305,7 +305,7 @@ pub mod pallet {
|
||||
/// Weight is a function of the number of proxies the user has (P).
|
||||
/// # </weight>
|
||||
/// TODO: Might be over counting 1 read
|
||||
#[pallet::weight(T::WeightInfo::anonymous(T::MaxProxies::get().into()))]
|
||||
#[pallet::weight(T::WeightInfo::anonymous(T::MaxProxies::get()))]
|
||||
pub fn anonymous(
|
||||
origin: OriginFor<T>,
|
||||
proxy_type: T::ProxyType,
|
||||
@@ -356,7 +356,7 @@ pub mod pallet {
|
||||
/// # <weight>
|
||||
/// Weight is a function of the number of proxies the user has (P).
|
||||
/// # </weight>
|
||||
#[pallet::weight(T::WeightInfo::kill_anonymous(T::MaxProxies::get().into()))]
|
||||
#[pallet::weight(T::WeightInfo::kill_anonymous(T::MaxProxies::get()))]
|
||||
pub fn kill_anonymous(
|
||||
origin: OriginFor<T>,
|
||||
spawner: T::AccountId,
|
||||
@@ -398,7 +398,7 @@ pub mod pallet {
|
||||
/// - A: the number of announcements made.
|
||||
/// - P: the number of proxies the user has.
|
||||
/// # </weight>
|
||||
#[pallet::weight(T::WeightInfo::announce(T::MaxPending::get(), T::MaxProxies::get().into()))]
|
||||
#[pallet::weight(T::WeightInfo::announce(T::MaxPending::get(), T::MaxProxies::get()))]
|
||||
pub fn announce(
|
||||
origin: OriginFor<T>,
|
||||
real: T::AccountId,
|
||||
@@ -408,12 +408,12 @@ pub mod pallet {
|
||||
Proxies::<T>::get(&real)
|
||||
.0
|
||||
.into_iter()
|
||||
.find(|x| &x.delegate == &who)
|
||||
.find(|x| x.delegate == who)
|
||||
.ok_or(Error::<T>::NotProxy)?;
|
||||
|
||||
let announcement = Announcement {
|
||||
real: real.clone(),
|
||||
call_hash: call_hash.clone(),
|
||||
call_hash,
|
||||
height: system::Pallet::<T>::block_number(),
|
||||
};
|
||||
|
||||
@@ -452,9 +452,10 @@ pub mod pallet {
|
||||
/// - A: the number of announcements made.
|
||||
/// - P: the number of proxies the user has.
|
||||
/// # </weight>
|
||||
#[pallet::weight(
|
||||
T::WeightInfo::remove_announcement(T::MaxPending::get(), T::MaxProxies::get().into())
|
||||
)]
|
||||
#[pallet::weight(T::WeightInfo::remove_announcement(
|
||||
T::MaxPending::get(),
|
||||
T::MaxProxies::get()
|
||||
))]
|
||||
pub fn remove_announcement(
|
||||
origin: OriginFor<T>,
|
||||
real: T::AccountId,
|
||||
@@ -482,9 +483,10 @@ pub mod pallet {
|
||||
/// - A: the number of announcements made.
|
||||
/// - P: the number of proxies the user has.
|
||||
/// # </weight>
|
||||
#[pallet::weight(
|
||||
T::WeightInfo::reject_announcement(T::MaxPending::get(), T::MaxProxies::get().into())
|
||||
)]
|
||||
#[pallet::weight(T::WeightInfo::reject_announcement(
|
||||
T::MaxPending::get(),
|
||||
T::MaxProxies::get()
|
||||
))]
|
||||
pub fn reject_announcement(
|
||||
origin: OriginFor<T>,
|
||||
delegate: T::AccountId,
|
||||
@@ -517,7 +519,7 @@ pub mod pallet {
|
||||
/// # </weight>
|
||||
#[pallet::weight({
|
||||
let di = call.get_dispatch_info();
|
||||
(T::WeightInfo::proxy_announced(T::MaxPending::get(), T::MaxProxies::get().into())
|
||||
(T::WeightInfo::proxy_announced(T::MaxPending::get(), T::MaxProxies::get())
|
||||
.saturating_add(di.weight)
|
||||
// AccountData for inner call origin accountdata.
|
||||
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
|
||||
@@ -759,9 +761,9 @@ impl<T: Config> Pallet<T> {
|
||||
let new_deposit =
|
||||
if len == 0 { BalanceOf::<T>::zero() } else { base + factor * (len as u32).into() };
|
||||
if new_deposit > old_deposit {
|
||||
T::Currency::reserve(&who, new_deposit - old_deposit)?;
|
||||
T::Currency::reserve(who, new_deposit - old_deposit)?;
|
||||
} else if new_deposit < old_deposit {
|
||||
T::Currency::unreserve(&who, old_deposit - new_deposit);
|
||||
T::Currency::unreserve(who, old_deposit - new_deposit);
|
||||
}
|
||||
Ok(if len == 0 { None } else { Some(new_deposit) })
|
||||
}
|
||||
@@ -816,7 +818,7 @@ impl<T: Config> Pallet<T> {
|
||||
// has.
|
||||
Some(Call::add_proxy { ref proxy_type, .. }) |
|
||||
Some(Call::remove_proxy { ref proxy_type, .. })
|
||||
if !def.proxy_type.is_superset(&proxy_type) =>
|
||||
if !def.proxy_type.is_superset(proxy_type) =>
|
||||
false,
|
||||
// Proxy call cannot remove all proxies or kill anonymous proxies unless it has full
|
||||
// permissions.
|
||||
|
||||
Reference in New Issue
Block a user