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

Commit 9428b0e

Browse files
skunertalvicsam
andauthored
Prepare for rust 1.62.1 (#11903)
* Update UI test output for rust 1.62.1 * switch ci to staging image to check that everything works * fix artifacts node-bench-regression-guard * Imeplement `scale_info::TypeInfo` manually to silence aggressive rust warning * Fix more clippy lints * Make clippy happy by relying on auto-deref were possible * Add tracking issue to the comments * pin ci image Co-authored-by: alvicsam <[email protected]>
1 parent 531d7c3 commit 9428b0e

Some content is hidden

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

45 files changed

+365
-84
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ variables: &default-vars
4747
CARGO_INCREMENTAL: 0
4848
DOCKER_OS: "debian:stretch"
4949
ARCH: "x86_64"
50-
CI_IMAGE: "paritytech/ci-linux:production"
50+
# change to production when this image is published
51+
CI_IMAGE: "paritytech/ci-linux:staging@sha256:2c90b67f1452ed2d7236c2cd13f6224053a833d521b3630650b679f00874e0a9"
5152
RUSTY_CACHIER_SINGLE_BRANCH: master
5253
RUSTY_CACHIER_DONT_OPERATE_ON_MAIN_BRANCH: "true"
5354

bin/node/bench/src/simple_trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct SimpleTrie<'a> {
3333

3434
impl<'a> AsHashDB<Hasher, DBValue> for SimpleTrie<'a> {
3535
fn as_hash_db(&self) -> &dyn hash_db::HashDB<Hasher, DBValue> {
36-
&*self
36+
self
3737
}
3838

3939
fn as_hash_db_mut<'b>(&'b mut self) -> &'b mut (dyn HashDB<Hasher, DBValue> + 'b) {

bin/node/cli/benches/transaction_pool.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,25 +243,25 @@ fn transaction_pool_benchmarks(c: &mut Criterion) {
243243
move |b| {
244244
b.iter_batched(
245245
|| {
246-
let prepare_extrinsics = create_account_extrinsics(&*node.client, &accounts);
246+
let prepare_extrinsics = create_account_extrinsics(&node.client, &accounts);
247247

248248
runtime.block_on(future::join_all(prepare_extrinsics.into_iter().map(|tx| {
249249
submit_tx_and_wait_for_inclusion(
250250
&node.transaction_pool,
251251
tx,
252-
&*node.client,
252+
&node.client,
253253
true,
254254
)
255255
})));
256256

257-
create_benchmark_extrinsics(&*node.client, &accounts, extrinsics_per_account)
257+
create_benchmark_extrinsics(&node.client, &accounts, extrinsics_per_account)
258258
},
259259
|extrinsics| {
260260
runtime.block_on(future::join_all(extrinsics.into_iter().map(|tx| {
261261
submit_tx_and_wait_for_inclusion(
262262
&node.transaction_pool,
263263
tx,
264-
&*node.client,
264+
&node.client,
265265
false,
266266
)
267267
})));

client/beefy/src/tests.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ fn finalize_block_and_wait_for_beefy(
467467
finalize_targets: &[u64],
468468
expected_beefy: &[u64],
469469
) {
470-
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
470+
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
471471

472472
for block in finalize_targets {
473473
let finalize = BlockId::number(*block);
@@ -555,15 +555,15 @@ fn lagging_validators() {
555555

556556
// Alice finalizes #25, Bob lags behind
557557
let finalize = BlockId::number(25);
558-
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
558+
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
559559
net.lock().peer(0).client().as_client().finalize_block(finalize, None).unwrap();
560560
// verify nothing gets finalized by BEEFY
561561
let timeout = Some(Duration::from_millis(250));
562562
streams_empty_after_timeout(best_blocks, &net, &mut runtime, timeout);
563563
streams_empty_after_timeout(signed_commitments, &net, &mut runtime, None);
564564

565565
// Bob catches up and also finalizes #25
566-
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
566+
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
567567
net.lock().peer(1).client().as_client().finalize_block(finalize, None).unwrap();
568568
// expected beefy finalizes block #17 from diff-power-of-two
569569
wait_for_best_beefy_blocks(best_blocks, &net, &mut runtime, &[23, 24, 25]);
@@ -577,7 +577,7 @@ fn lagging_validators() {
577577
// validator set).
578578

579579
// Alice finalizes session-boundary mandatory block #60, Bob lags behind
580-
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
580+
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
581581
let finalize = BlockId::number(60);
582582
net.lock().peer(0).client().as_client().finalize_block(finalize, None).unwrap();
583583
// verify nothing gets finalized by BEEFY
@@ -586,7 +586,7 @@ fn lagging_validators() {
586586
streams_empty_after_timeout(signed_commitments, &net, &mut runtime, None);
587587

588588
// Bob catches up and also finalizes #60 (and should have buffered Alice's vote on #60)
589-
let (best_blocks, signed_commitments) = get_beefy_streams(&mut *net.lock(), peers);
589+
let (best_blocks, signed_commitments) = get_beefy_streams(&mut net.lock(), peers);
590590
net.lock().peer(1).client().as_client().finalize_block(finalize, None).unwrap();
591591
// verify beefy skips intermediary votes, and successfully finalizes mandatory block #40
592592
wait_for_best_beefy_blocks(best_blocks, &net, &mut runtime, &[60]);
@@ -629,7 +629,7 @@ fn correct_beefy_payload() {
629629
finalize_block_and_wait_for_beefy(&net, peers, &mut runtime, &[10], &[1, 9]);
630630

631631
let (best_blocks, signed_commitments) =
632-
get_beefy_streams(&mut *net.lock(), &[BeefyKeyring::Alice]);
632+
get_beefy_streams(&mut net.lock(), &[BeefyKeyring::Alice]);
633633

634634
// now 2 good validators and 1 bad one are voting
635635
net.lock()
@@ -658,7 +658,7 @@ fn correct_beefy_payload() {
658658

659659
// 3rd good validator catches up and votes as well
660660
let (best_blocks, signed_commitments) =
661-
get_beefy_streams(&mut *net.lock(), &[BeefyKeyring::Alice]);
661+
get_beefy_streams(&mut net.lock(), &[BeefyKeyring::Alice]);
662662
net.lock()
663663
.peer(2)
664664
.client()

client/beefy/src/worker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ where
439439
let commitment = Commitment { payload, block_number: target_number, validator_set_id };
440440
let encoded_commitment = commitment.encode();
441441

442-
let signature = match self.key_store.sign(&authority_id, &*encoded_commitment) {
442+
let signature = match self.key_store.sign(&authority_id, &encoded_commitment) {
443443
Ok(sig) => sig,
444444
Err(err) => {
445445
warn!(target: "beefy", "🥩 Error signing commitment: {:?}", err);
@@ -451,7 +451,7 @@ where
451451
target: "beefy",
452452
"🥩 Produced signature using {:?}, is_valid: {:?}",
453453
authority_id,
454-
BeefyKeystore::verify(&authority_id, &signature, &*encoded_commitment)
454+
BeefyKeystore::verify(&authority_id, &signature, &encoded_commitment)
455455
);
456456

457457
let message = VoteMessage { commitment, id: authority_id, signature };

client/cli/src/commands/run_cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ impl std::error::Error for TelemetryParsingError {}
556556

557557
impl std::fmt::Display for TelemetryParsingError {
558558
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
559-
match &*self {
559+
match self {
560560
TelemetryParsingError::MissingVerbosity => write!(f, "Verbosity level missing"),
561561
TelemetryParsingError::VerbosityParsingError(e) => write!(f, "{}", e),
562562
}

client/consensus/common/src/block_import.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ impl<B: BlockT> JustificationSyncLink<B> for () {
433433

434434
impl<B: BlockT, L: JustificationSyncLink<B>> JustificationSyncLink<B> for Arc<L> {
435435
fn request_justification(&self, hash: &B::Hash, number: NumberFor<B>) {
436-
L::request_justification(&*self, hash, number);
436+
L::request_justification(self, hash, number);
437437
}
438438

439439
fn clear_justification_requests(&self) {
440-
L::clear_justification_requests(&*self);
440+
L::clear_justification_requests(self);
441441
}
442442
}

client/db/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2292,7 +2292,7 @@ impl<Block: BlockT> sc_client_api::backend::Backend<Block> for Backend<Block> {
22922292
}
22932293

22942294
fn get_import_lock(&self) -> &RwLock<()> {
2295-
&*self.import_lock
2295+
&self.import_lock
22962296
}
22972297

22982298
fn requires_full_sync(&self) -> bool {

client/finality-grandpa/src/communication/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
320320
voters: Arc<VoterSet<AuthorityId>>,
321321
has_voted: HasVoted<B>,
322322
) -> (impl Stream<Item = SignedMessage<B>> + Unpin, OutgoingMessages<B>) {
323-
self.note_round(round, set_id, &*voters);
323+
self.note_round(round, set_id, &voters);
324324

325325
let keystore = keystore.and_then(|ks| {
326326
let id = ks.local_id();
@@ -637,9 +637,9 @@ fn incoming_global<B: BlockT>(
637637
.filter_map(move |(notification, msg)| {
638638
future::ready(match msg {
639639
GossipMessage::Commit(msg) =>
640-
process_commit(msg, notification, &gossip_engine, &gossip_validator, &*voters),
640+
process_commit(msg, notification, &gossip_engine, &gossip_validator, &voters),
641641
GossipMessage::CatchUp(msg) =>
642-
process_catch_up(msg, notification, &gossip_engine, &gossip_validator, &*voters),
642+
process_catch_up(msg, notification, &gossip_engine, &gossip_validator, &voters),
643643
_ => {
644644
debug!(target: "afg", "Skipping unknown message type");
645645
None

client/finality-grandpa/src/import.rs

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

285285
impl<'a, H, N> InnerGuard<'a, H, N> {
286286
fn as_mut(&mut self) -> &mut AuthoritySet<H, N> {
287-
&mut **self.guard.as_mut().expect("only taken on deconstruction; qed")
287+
self.guard.as_mut().expect("only taken on deconstruction; qed")
288288
}
289289

290290
fn set_old(&mut self, old: AuthoritySet<H, N>) {

client/finality-grandpa/src/observer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ where
289289
network.note_round(
290290
crate::communication::Round(round),
291291
crate::communication::SetId(set_id),
292-
&*voters,
292+
&voters,
293293
)
294294
}
295295
};

client/rpc/src/offchain/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<T: OffchainStorage + 'static> OffchainApiServer for Offchain<T> {
5757
StorageKind::PERSISTENT => sp_offchain::STORAGE_PREFIX,
5858
StorageKind::LOCAL => return Err(JsonRpseeError::from(Error::UnavailableStorageKind)),
5959
};
60-
self.storage.write().set(prefix, &*key, &*value);
60+
self.storage.write().set(prefix, &key, &value);
6161
Ok(())
6262
}
6363

@@ -69,6 +69,6 @@ impl<T: OffchainStorage + 'static> OffchainApiServer for Offchain<T> {
6969
StorageKind::LOCAL => return Err(JsonRpseeError::from(Error::UnavailableStorageKind)),
7070
};
7171

72-
Ok(self.storage.read().get(prefix, &*key).map(Into::into))
72+
Ok(self.storage.read().get(prefix, &key).map(Into::into))
7373
}
7474
}

client/rpc/src/state/state_full.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ where
199199
.call(
200200
&BlockId::Hash(block),
201201
&method,
202-
&*call_data,
202+
&call_data,
203203
self.client.execution_extensions().strategies().other,
204204
None,
205205
)

client/service/src/client/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,11 +1614,11 @@ where
16141614
RA: Send + Sync,
16151615
{
16161616
fn header(&self, id: BlockId<Block>) -> sp_blockchain::Result<Option<Block::Header>> {
1617-
(**self).backend.blockchain().header(id)
1617+
self.backend.blockchain().header(id)
16181618
}
16191619

16201620
fn info(&self) -> blockchain::Info<Block> {
1621-
(**self).backend.blockchain().info()
1621+
self.backend.blockchain().info()
16221622
}
16231623

16241624
fn status(&self, id: BlockId<Block>) -> sp_blockchain::Result<blockchain::BlockStatus> {

client/tracing/src/logging/stderr_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn flush_logs(mut buffer: parking_lot::lock_api::MutexGuard<parking_lot::RawMute
8989

9090
let stderr = std::io::stderr();
9191
let mut stderr_lock = stderr.lock();
92-
let _ = stderr_lock.write_all(&*spare_buffer);
92+
let _ = stderr_lock.write_all(&spare_buffer);
9393
std::mem::drop(stderr_lock);
9494

9595
spare_buffer.clear();

client/transaction-pool/tests/pool.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ fn should_resubmit_from_retracted_during_maintenance() {
254254
let header = api.push_block(1, vec![], true);
255255
let fork_header = api.push_block(1, vec![], false);
256256

257-
let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api());
257+
let event = block_event_with_retracted(header, fork_header.hash(), pool.api());
258258

259259
block_on(pool.maintain(event));
260260
assert_eq!(pool.status().ready, 1);
@@ -272,7 +272,7 @@ fn should_not_resubmit_from_retracted_during_maintenance_if_tx_is_also_in_enacte
272272
let header = api.push_block(1, vec![xt.clone()], true);
273273
let fork_header = api.push_block(1, vec![xt], false);
274274

275-
let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api());
275+
let event = block_event_with_retracted(header, fork_header.hash(), pool.api());
276276

277277
block_on(pool.maintain(event));
278278
assert_eq!(pool.status().ready, 0);
@@ -292,7 +292,7 @@ fn should_not_retain_invalid_hashes_from_retracted() {
292292
let fork_header = api.push_block(1, vec![xt.clone()], false);
293293
api.add_invalid(&xt);
294294

295-
let event = block_event_with_retracted(header, fork_header.hash(), &*pool.api());
295+
let event = block_event_with_retracted(header, fork_header.hash(), pool.api());
296296
block_on(pool.maintain(event));
297297

298298
assert_eq!(
@@ -533,7 +533,7 @@ fn fork_aware_finalization() {
533533
let header = pool.api().push_block(3, vec![from_charlie.clone()], true);
534534

535535
canon_watchers.push((watcher, header.hash()));
536-
let event = block_event_with_retracted(header.clone(), d2, &*pool.api());
536+
let event = block_event_with_retracted(header.clone(), d2, pool.api());
537537
block_on(pool.maintain(event));
538538
assert_eq!(pool.status().ready, 2);
539539

@@ -633,7 +633,7 @@ fn prune_and_retract_tx_at_same_time() {
633633
let header = pool.api().push_block(2, vec![from_alice.clone()], false);
634634
assert_eq!(pool.status().ready, 0);
635635

636-
let event = block_event_with_retracted(header.clone(), b1, &*pool.api());
636+
let event = block_event_with_retracted(header.clone(), b1, pool.api());
637637
block_on(pool.maintain(event));
638638
assert_eq!(pool.status().ready, 0);
639639

@@ -708,7 +708,7 @@ fn resubmit_tx_of_fork_that_is_not_part_of_retracted() {
708708
// Block D2
709709
{
710710
let header = pool.api().push_block(2, vec![], false);
711-
let event = block_event_with_retracted(header, d0, &*pool.api());
711+
let event = block_event_with_retracted(header, d0, pool.api());
712712
block_on(pool.maintain(event));
713713
assert_eq!(pool.status().ready, 2);
714714
}
@@ -801,7 +801,7 @@ fn resubmit_from_retracted_fork() {
801801
let expected_ready = vec![tx3, tx4, tx5].iter().map(Encode::encode).collect::<BTreeSet<_>>();
802802
assert_eq!(expected_ready, ready);
803803

804-
let event = block_event_with_retracted(f1_header, f0, &*pool.api());
804+
let event = block_event_with_retracted(f1_header, f0, pool.api());
805805
block_on(pool.maintain(event));
806806

807807
assert_eq!(pool.status().ready, 3);

frame/contracts/src/exec.rs

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

13161316
fn deposit_event<T: Config>(topics: Vec<T::Hash>, event: Event<T>) {
13171317
<frame_system::Pallet<T>>::deposit_event_indexed(
1318-
&*topics,
1318+
&topics,
13191319
<T as Config>::Event::from(event).into(),
13201320
)
13211321
}

frame/executive/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ mod tests {
573573
use pallet_balances::Call as BalancesCall;
574574
use pallet_transaction_payment::CurrencyAdapter;
575575

576-
const TEST_KEY: &[u8] = &*b":test:key:";
576+
const TEST_KEY: &[u8] = b":test:key:";
577577

578578
#[frame_support::pallet]
579579
mod custom {
@@ -806,7 +806,7 @@ mod tests {
806806
type TestUncheckedExtrinsic = TestXt;
807807

808808
// Will contain `true` when the custom runtime logic was called.
809-
const CUSTOM_ON_RUNTIME_KEY: &[u8] = &*b":custom:on_runtime";
809+
const CUSTOM_ON_RUNTIME_KEY: &[u8] = b":custom:on_runtime";
810810

811811
struct CustomOnRuntimeUpgrade;
812812
impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {

frame/offences/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<Reporter, Offender> offence::OnOffenceHandler<Reporter, Offender, Weight>
6767
}
6868

6969
pub fn with_on_offence_fractions<R, F: FnOnce(&mut Vec<Perbill>) -> R>(f: F) -> R {
70-
ON_OFFENCE_PERBILL.with(|fractions| f(&mut *fractions.borrow_mut()))
70+
ON_OFFENCE_PERBILL.with(|fractions| f(&mut fractions.borrow_mut()))
7171
}
7272

7373
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;

frame/support/procedural/src/pallet/parse/call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl CallDef {
188188
return Err(syn::Error::new(method.sig.span(), msg))
189189
},
190190
Some(syn::FnArg::Typed(arg)) => {
191-
check_dispatchable_first_arg_type(&*arg.ty)?;
191+
check_dispatchable_first_arg_type(&arg.ty)?;
192192
},
193193
}
194194

frame/support/test/tests/construct_runtime_ui/no_std_genesis_config.stderr

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ help: consider importing this struct
2929
|
3030
1 | use frame_system::GenesisConfig;
3131
|
32+
help: if you import `GenesisConfig`, refer to it directly
33+
|
34+
40 - construct_runtime! {
35+
41 - pub enum Runtime where
36+
42 - Block = Block,
37+
43 - NodeBlock = Block,
38+
44 - UncheckedExtrinsic = UncheckedExtrinsic
39+
45 - {
40+
46 - System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
41+
47 - Pallet: test_pallet::{Pallet, Config},
42+
48 - }
43+
49 - }
44+
|
3245

3346
error[E0283]: type annotations needed
3447
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1

0 commit comments

Comments
 (0)