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:
Falco Hirschenberger
2022-04-30 23:28:27 +02:00
committed by GitHub
parent a990473cf9
commit b581604aa7
368 changed files with 1927 additions and 2236 deletions
+8 -10
View File
@@ -215,7 +215,8 @@ impl<T: Config> Pallet<T> {
// previously requested. This also allows the tx to pay no fee.
let was_requested = match (StatusFor::<T>::get(hash), maybe_depositor) {
(Some(RequestStatus::Requested(..)), _) => true,
(Some(RequestStatus::Unrequested(..)), _) => Err(Error::<T>::AlreadyNoted)?,
(Some(RequestStatus::Unrequested(..)), _) =>
return Err(Error::<T>::AlreadyNoted.into()),
(None, None) => {
StatusFor::<T>::insert(hash, RequestStatus::Unrequested(None));
false
@@ -256,7 +257,7 @@ impl<T: Config> Pallet<T> {
});
StatusFor::<T>::insert(hash, RequestStatus::Requested(count));
if count == 1 {
Self::deposit_event(Event::Requested { hash: hash.clone() });
Self::deposit_event(Event::Requested { hash: *hash });
}
}
@@ -270,20 +271,17 @@ impl<T: Config> Pallet<T> {
) -> DispatchResult {
match StatusFor::<T>::get(hash).ok_or(Error::<T>::NotNoted)? {
RequestStatus::Unrequested(Some((owner, deposit))) => {
ensure!(
maybe_check_owner.map_or(true, |c| &c == &owner),
Error::<T>::NotAuthorized
);
ensure!(maybe_check_owner.map_or(true, |c| c == owner), Error::<T>::NotAuthorized);
T::Currency::unreserve(&owner, deposit);
},
RequestStatus::Unrequested(None) => {
ensure!(maybe_check_owner.is_none(), Error::<T>::NotAuthorized);
},
RequestStatus::Requested(_) => Err(Error::<T>::Requested)?,
RequestStatus::Requested(_) => return Err(Error::<T>::Requested.into()),
}
StatusFor::<T>::remove(hash);
PreimageFor::<T>::remove(hash);
Self::deposit_event(Event::Cleared { hash: hash.clone() });
Self::deposit_event(Event::Cleared { hash: *hash });
Ok(())
}
@@ -298,9 +296,9 @@ impl<T: Config> Pallet<T> {
debug_assert!(count == 1, "preimage request counter at zero?");
PreimageFor::<T>::remove(hash);
StatusFor::<T>::remove(hash);
Self::deposit_event(Event::Cleared { hash: hash.clone() });
Self::deposit_event(Event::Cleared { hash: *hash });
},
RequestStatus::Unrequested(_) => Err(Error::<T>::NotRequested)?,
RequestStatus::Unrequested(_) => return Err(Error::<T>::NotRequested.into()),
}
Ok(())
}