Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 0ba251c

Browse files
hirschenbergerbkchrgilescope
authored
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>
1 parent c5a7fdd commit 0ba251c

File tree

368 files changed

+1938
-2247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

368 files changed

+1938
-2247
lines changed

bin/node-template/node/src/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ where
4343

4444
io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)));
4545

46-
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone())));
46+
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client)));
4747

4848
// Extend this RPC with a custom API by using the following syntax.
4949
// `YourRpcStruct` should have a reference to a client, which is needed

bin/node-template/node/src/service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn new_partial(
8282

8383
let (client, backend, keystore_container, task_manager) =
8484
sc_service::new_full_parts::<Block, RuntimeApi, _>(
85-
&config,
85+
config,
8686
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
8787
executor,
8888
)?;
@@ -263,7 +263,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
263263
let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _, _, _>(
264264
StartAuraParams {
265265
slot_duration,
266-
client: client.clone(),
266+
client,
267267
select_chain,
268268
block_import,
269269
proposer_factory,

bin/node-template/pallets/template/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub mod pallet {
8888
// Read a value from storage.
8989
match <Something<T>>::get() {
9090
// Return an error if the value has not been set.
91-
None => Err(Error::<T>::NoneValue)?,
91+
None => return Err(Error::<T>::NoneValue.into()),
9292
Some(old) => {
9393
// Increment the value read from storage; will error in the event of overflow.
9494
let new = old.checked_add(1).ok_or(Error::<T>::StorageOverflow)?;

bin/node-template/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ impl_runtime_apis! {
478478

479479
let storage_info = AllPalletsWithSystem::storage_info();
480480

481-
return (list, storage_info)
481+
(list, storage_info)
482482
}
483483

484484
fn dispatch_benchmark(

bin/node/bench/src/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub fn run_benchmark(benchmark: Box<dyn BenchmarkDescription>, mode: Mode) -> Be
132132
durations.push(duration.as_nanos());
133133
}
134134

135-
durations.sort();
135+
durations.sort_unstable();
136136

137137
let raw_average = (durations.iter().sum::<u128>() / (durations.len() as u128)) as u64;
138138
let average = (durations.iter().skip(10).take(30).sum::<u128>() / 30) as u64;

bin/node/bench/src/main.rs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,22 @@ fn main() {
8585

8686
let mut import_benchmarks = Vec::new();
8787

88-
for profile in [Profile::Wasm, Profile::Native].iter() {
88+
for profile in [Profile::Wasm, Profile::Native] {
8989
for size in [
9090
SizeType::Empty,
9191
SizeType::Small,
9292
SizeType::Medium,
9393
SizeType::Large,
9494
SizeType::Full,
9595
SizeType::Custom(opt.transactions.unwrap_or(0)),
96-
]
97-
.iter()
98-
{
96+
] {
9997
for block_type in [
10098
BlockType::RandomTransfersKeepAlive,
10199
BlockType::RandomTransfersReaping,
102100
BlockType::Noop,
103-
]
104-
.iter()
105-
{
106-
for database_type in
107-
[BenchDataBaseType::RocksDb, BenchDataBaseType::ParityDb].iter()
108-
{
109-
import_benchmarks.push((
110-
profile,
111-
size.clone(),
112-
block_type.clone(),
113-
database_type,
114-
));
101+
] {
102+
for database_type in [BenchDataBaseType::RocksDb, BenchDataBaseType::ParityDb] {
103+
import_benchmarks.push((profile, size, block_type, database_type));
115104
}
116105
}
117106
}
@@ -120,11 +109,11 @@ fn main() {
120109
let benchmarks = matrix!(
121110
(profile, size, block_type, database_type) in import_benchmarks.into_iter() =>
122111
ImportBenchmarkDescription {
123-
profile: *profile,
112+
profile,
124113
key_types: KeyTypes::Sr25519,
125-
size: size,
126-
block_type: block_type,
127-
database_type: *database_type,
114+
size,
115+
block_type,
116+
database_type,
128117
},
129118
(size, db_type) in
130119
[

bin/node/bench/src/state_sizes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1818

1919
/// Kusama value size distribution
20-
pub const KUSAMA_STATE_DISTRIBUTION: &'static [(u32, u32)] = &[
20+
pub const KUSAMA_STATE_DISTRIBUTION: &[(u32, u32)] = &[
2121
(32, 35),
2222
(33, 20035),
2323
(34, 5369),

bin/node/bench/src/trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl core::Benchmark for TrieWriteBenchmark {
282282
let mut db = self.database.clone();
283283
let kvdb = db.open(self.database_type);
284284

285-
let mut new_root = self.root.clone();
285+
let mut new_root = self.root;
286286

287287
let mut overlay = HashMap::new();
288288
let mut trie = SimpleTrie { db: kvdb.clone(), overlay: &mut overlay };

bin/node/cli/src/service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ pub fn create_extrinsic(
113113
let signature = raw_payload.using_encoded(|e| sender.sign(e));
114114

115115
node_runtime::UncheckedExtrinsic::new_signed(
116-
function.clone(),
116+
function,
117117
sp_runtime::AccountId32::from(sender.public()).into(),
118-
node_runtime::Signature::Sr25519(signature.clone()),
119-
extra.clone(),
118+
node_runtime::Signature::Sr25519(signature),
119+
extra,
120120
)
121121
}
122122

bin/node/runtime/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ impl Get<Option<(usize, ExtendedBalance)>> for OffchainRandomBalancing {
631631
use sp_runtime::traits::TrailingZeroInput;
632632
let iters = match MINER_MAX_ITERATIONS {
633633
0 => 0,
634-
max @ _ => {
634+
max => {
635635
let seed = sp_io::offchain::random_seed();
636636
let random = <u32>::decode(&mut TrailingZeroInput::new(&seed))
637637
.expect("input is padded with zeroes; qed") %
@@ -1148,7 +1148,7 @@ where
11481148
let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?;
11491149
let address = Indices::unlookup(account);
11501150
let (call, extra, _) = raw_payload.deconstruct();
1151-
Some((call, (address, signature.into(), extra)))
1151+
Some((call, (address, signature, extra)))
11521152
}
11531153
}
11541154

@@ -1911,7 +1911,7 @@ impl_runtime_apis! {
19111911

19121912
let storage_info = AllPalletsWithSystem::storage_info();
19131913

1914-
return (list, storage_info)
1914+
(list, storage_info)
19151915
}
19161916

19171917
fn dispatch_benchmark(

0 commit comments

Comments
 (0)