Cleanup some warnings (#7816)

* client: cleanup redundant semicolon warnings

* grandpa: remove usage of deprecated compare_and_swap
This commit is contained in:
André Silva
2021-01-03 23:29:46 +00:00
committed by GitHub
parent 672a2912b8
commit e367d57baf
6 changed files with 9 additions and 9 deletions
@@ -846,7 +846,7 @@ fn check_catch_up<Block: BlockT>(
}
Ok(())
};
}
check_weight(
voters,
@@ -25,7 +25,7 @@ use parking_lot::RwLockWriteGuard;
use sp_blockchain::{BlockStatus, well_known_cache_keys};
use sc_client_api::{backend::Backend, utils::is_descendent_of};
use sp_utils::mpsc::TracingUnboundedSender;
use sp_api::{TransactionFor};
use sp_api::TransactionFor;
use sp_consensus::{
BlockImport, Error as ConsensusError,
@@ -1068,7 +1068,7 @@ fn voter_persists_its_votes() {
drop(_block_import);
r
})
};
}
runtime.spawn(alice_voter1);
@@ -1110,7 +1110,7 @@ fn voter_persists_its_votes() {
let runtime_handle = runtime_handle.clone();
async move {
if state.compare_and_swap(0, 1, Ordering::SeqCst) == 0 {
if state.compare_exchange(0, 1, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 0 {
// the first message we receive should be a prevote from alice.
let prevote = match signed.message {
finality_grandpa::Message::Prevote(prevote) => prevote,
@@ -1156,7 +1156,7 @@ fn voter_persists_its_votes() {
// we send in a loop including a delay until items are received, this can be
// ignored for the sake of reduced complexity.
Pin::new(&mut *round_tx.lock()).start_send(finality_grandpa::Message::Prevote(prevote)).unwrap();
} else if state.compare_and_swap(1, 2, Ordering::SeqCst) == 1 {
} else if state.compare_exchange(1, 2, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 1 {
// the next message we receive should be our own prevote
let prevote = match signed.message {
finality_grandpa::Message::Prevote(prevote) => prevote,
@@ -1170,7 +1170,7 @@ fn voter_persists_its_votes() {
// therefore we won't ever receive it again since it will be a
// known message on the gossip layer
} else if state.compare_and_swap(2, 3, Ordering::SeqCst) == 2 {
} else if state.compare_exchange(2, 3, Ordering::SeqCst, Ordering::SeqCst).unwrap() == 2 {
// we then receive a precommit from alice for block 15
// even though we casted a prevote for block 30
let precommit = match signed.message {
@@ -401,7 +401,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
storage: &'a dyn ChangesTrieStorage<HashFor<Block>, NumberFor<Block>>,
min: NumberFor<Block>,
required_roots_proofs: Mutex<BTreeMap<NumberFor<Block>, Block::Hash>>,
};
}
impl<'a, Block: BlockT> ChangesTrieRootsStorage<HashFor<Block>, NumberFor<Block>> for
AccessedRootsRecorder<'a, Block>
@@ -286,7 +286,7 @@ impl<B: ChainApi> ValidatedPool<B> {
/// Transactions that are missing from the pool are not submitted.
pub fn resubmit(&self, mut updated_transactions: HashMap<ExtrinsicHash<B>, ValidatedTransactionFor<B>>) {
#[derive(Debug, Clone, Copy, PartialEq)]
enum Status { Future, Ready, Failed, Dropped };
enum Status { Future, Ready, Failed, Dropped }
let (mut initial_statuses, final_statuses) = {
let mut pool = self.pool.write();
+1 -1
View File
@@ -1224,7 +1224,7 @@ mod test {
#[test]
fn finalize_with_descendent_works() {
#[derive(Debug, PartialEq)]
struct Change { effective: u64 };
struct Change { effective: u64 }
let (mut tree, is_descendent_of) = {
let mut tree = ForkTree::new();