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

Commit 5215cd7

Browse files
authored
Cleanup some warnings (#7816)
* client: cleanup redundant semicolon warnings * grandpa: remove usage of deprecated compare_and_swap
1 parent e8a8301 commit 5215cd7

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ fn check_catch_up<Block: BlockT>(
846846
}
847847

848848
Ok(())
849-
};
849+
}
850850

851851
check_weight(
852852
voters,

client/finality-grandpa/src/import.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use parking_lot::RwLockWriteGuard;
2525
use sp_blockchain::{BlockStatus, well_known_cache_keys};
2626
use sc_client_api::{backend::Backend, utils::is_descendent_of};
2727
use sp_utils::mpsc::TracingUnboundedSender;
28-
use sp_api::{TransactionFor};
28+
use sp_api::TransactionFor;
2929

3030
use sp_consensus::{
3131
BlockImport, Error as ConsensusError,

client/finality-grandpa/src/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ fn voter_persists_its_votes() {
10681068
drop(_block_import);
10691069
r
10701070
})
1071-
};
1071+
}
10721072

10731073
runtime.spawn(alice_voter1);
10741074

@@ -1110,7 +1110,7 @@ fn voter_persists_its_votes() {
11101110
let runtime_handle = runtime_handle.clone();
11111111

11121112
async move {
1113-
if state.compare_and_swap(0, 1, Ordering::SeqCst) == 0 {
1113+
if state.compare_exchange(0, 1, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 0 {
11141114
// the first message we receive should be a prevote from alice.
11151115
let prevote = match signed.message {
11161116
finality_grandpa::Message::Prevote(prevote) => prevote,
@@ -1156,7 +1156,7 @@ fn voter_persists_its_votes() {
11561156
// we send in a loop including a delay until items are received, this can be
11571157
// ignored for the sake of reduced complexity.
11581158
Pin::new(&mut *round_tx.lock()).start_send(finality_grandpa::Message::Prevote(prevote)).unwrap();
1159-
} else if state.compare_and_swap(1, 2, Ordering::SeqCst) == 1 {
1159+
} else if state.compare_exchange(1, 2, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 1 {
11601160
// the next message we receive should be our own prevote
11611161
let prevote = match signed.message {
11621162
finality_grandpa::Message::Prevote(prevote) => prevote,
@@ -1170,7 +1170,7 @@ fn voter_persists_its_votes() {
11701170
// therefore we won't ever receive it again since it will be a
11711171
// known message on the gossip layer
11721172

1173-
} else if state.compare_and_swap(2, 3, Ordering::SeqCst) == 2 {
1173+
} else if state.compare_exchange(2, 3, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 2 {
11741174
// we then receive a precommit from alice for block 15
11751175
// even though we casted a prevote for block 30
11761176
let precommit = match signed.message {

client/service/src/client/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
401401
storage: &'a dyn ChangesTrieStorage<HashFor<Block>, NumberFor<Block>>,
402402
min: NumberFor<Block>,
403403
required_roots_proofs: Mutex<BTreeMap<NumberFor<Block>, Block::Hash>>,
404-
};
404+
}
405405

406406
impl<'a, Block: BlockT> ChangesTrieRootsStorage<HashFor<Block>, NumberFor<Block>> for
407407
AccessedRootsRecorder<'a, Block>

client/transaction-pool/graph/src/validated_pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<B: ChainApi> ValidatedPool<B> {
286286
/// Transactions that are missing from the pool are not submitted.
287287
pub fn resubmit(&self, mut updated_transactions: HashMap<ExtrinsicHash<B>, ValidatedTransactionFor<B>>) {
288288
#[derive(Debug, Clone, Copy, PartialEq)]
289-
enum Status { Future, Ready, Failed, Dropped };
289+
enum Status { Future, Ready, Failed, Dropped }
290290

291291
let (mut initial_statuses, final_statuses) = {
292292
let mut pool = self.pool.write();

utils/fork-tree/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ mod test {
12241224
#[test]
12251225
fn finalize_with_descendent_works() {
12261226
#[derive(Debug, PartialEq)]
1227-
struct Change { effective: u64 };
1227+
struct Change { effective: u64 }
12281228

12291229
let (mut tree, is_descendent_of) = {
12301230
let mut tree = ForkTree::new();

0 commit comments

Comments
 (0)