Unverified Commit 4165c7f8 authored by Sergey Pepyakin's avatar Sergey Pepyakin Committed by GitHub
Browse files

Mass replace `,);` pattern (#3580)

This is an artifact left by rustfmt which is not dare to remove the
comma being conservative.
parent 67fd660f
Pipeline #151398 passed with stages
in 39 minutes and 46 seconds
......@@ -470,7 +470,7 @@ mod tests {
assert_ok!(Exchange::import_peer_transaction(
Origin::signed(SUBMITTER),
(true, transaction),
),);
));
// ensure that the transfer has been marked as completed
assert!(<Exchange as crate::Store>::Transfers::contains_key(0u64));
......@@ -485,7 +485,7 @@ mod tests {
assert_ok!(Exchange::import_peer_transaction(
Origin::signed(SUBMITTER),
(true, transaction(0)),
),);
));
// ensure that the transfer has been marked as completed
assert!(<Exchange as crate::Store>::Transfers::contains_key(0u64));
......
......@@ -336,7 +336,7 @@ mod tests {
Some(vec![validators_change_receipt(latest_block_id.hash)]),
)
.unwrap();
assert_eq!(finalized_blocks, vec![(parent_id, Some(100))],);
assert_eq!(finalized_blocks, vec![(parent_id, Some(100))]);
assert!(storage.header(&ctx.genesis.compute_hash()).is_none());
latest_block_id = rolling_last_block_id;
......@@ -362,7 +362,7 @@ mod tests {
None,
)
.unwrap();
assert_eq!(finalized_blocks, vec![],);
assert_eq!(finalized_blocks, vec![]);
latest_block_id = rolling_last_block_id;
step += 3;
}
......
......@@ -1415,7 +1415,7 @@ pub(crate) mod tests {
example_header().compute_hash(),
1,
&[],
),);
));
});
}
......
......@@ -359,7 +359,7 @@ pub(crate) mod tests {
// when we're inside list range
header.number = 150;
assert_eq!(validators.extract_validators_change(&header, None), Ok((None, None)),);
assert_eq!(validators.extract_validators_change(&header, None), Ok((None, None)));
// when we're at the block that switches to contract source
header.number = 200;
......@@ -459,7 +459,7 @@ pub(crate) mod tests {
#[test]
fn finalize_validators_change_does_not_finalize_when_changes_are_not_scheduled() {
assert_eq!(try_finalize_with_scheduled_change(None), None,);
assert_eq!(try_finalize_with_scheduled_change(None), None);
}
#[test]
......@@ -468,6 +468,6 @@ pub(crate) mod tests {
number: 5,
..Default::default()
};
assert_eq!(try_finalize_with_scheduled_change(Some(id5)), None,);
assert_eq!(try_finalize_with_scheduled_change(Some(id5)), None);
}
}
......@@ -777,7 +777,7 @@ mod tests {
run_test(|| {
<IsHalted<TestRuntime>>::put(true);
assert_noop!(submit_finality_proof(1), Error::<TestRuntime>::Halted,);
assert_noop!(submit_finality_proof(1), Error::<TestRuntime>::Halted);
})
}
......
......@@ -1301,7 +1301,7 @@ mod tests {
Ok(vec![message(1, REGULAR_PAYLOAD)]).into(),
1,
REGULAR_PAYLOAD.declared_weight,
),);
));
assert_ok!(Pallet::<TestRuntime>::receive_messages_delivery_proof(
Origin::signed(1),
......@@ -1660,7 +1660,7 @@ mod tests {
Ok(vec![invalid_message]).into(),
1,
0, // weight may be zero in this case (all messages are improperly encoded)
),);
));
assert_eq!(
InboundLanes::<TestRuntime>::get(&TEST_LANE_ID).last_delivered_nonce(),
......@@ -1686,7 +1686,7 @@ mod tests {
.into(),
3,
REGULAR_PAYLOAD.declared_weight + REGULAR_PAYLOAD.declared_weight,
),);
));
assert_eq!(
InboundLanes::<TestRuntime>::get(&TEST_LANE_ID).last_delivered_nonce(),
......@@ -1802,7 +1802,7 @@ mod tests {
TEST_LANE_ID,
1,
100,
),);
));
assert!(TestMessageDeliveryAndDispatchPayment::is_fee_paid(1, 100));
});
}
......
......@@ -210,19 +210,19 @@ mod tests {
let all_accs = vec![1, 2, 3, 4, 5];
// at least 1 validator is selected
assert_eq!(Pallet::<TestRuntime>::select_validators(0, &[1]), vec![1],);
assert_eq!(Pallet::<TestRuntime>::select_validators(0, &[1]), vec![1]);
// at session#0, shift is also 0
assert_eq!(Pallet::<TestRuntime>::select_validators(0, &all_accs), vec![1, 2, 3],);
assert_eq!(Pallet::<TestRuntime>::select_validators(0, &all_accs), vec![1, 2, 3]);
// at session#1, shift is also 1
assert_eq!(Pallet::<TestRuntime>::select_validators(1, &all_accs), vec![2, 3, 4],);
assert_eq!(Pallet::<TestRuntime>::select_validators(1, &all_accs), vec![2, 3, 4]);
// at session#3, we're wrapping
assert_eq!(Pallet::<TestRuntime>::select_validators(3, &all_accs), vec![4, 5, 1],);
assert_eq!(Pallet::<TestRuntime>::select_validators(3, &all_accs), vec![4, 5, 1]);
// at session#5, we're starting from the beginning again
assert_eq!(Pallet::<TestRuntime>::select_validators(5, &all_accs), vec![1, 2, 3],);
assert_eq!(Pallet::<TestRuntime>::select_validators(5, &all_accs), vec![1, 2, 3]);
});
}
}
......@@ -729,6 +729,6 @@ mod tests {
stream.append(&2u64);
stream.append(&3u64);
assert_eq!(Receipt::is_successful_raw_receipt(&stream.out()), Ok(false),);
assert_eq!(Receipt::is_successful_raw_receipt(&stream.out()), Ok(false));
}
}
......@@ -431,7 +431,7 @@ async fn submit_substrate_headers_batch(
mut ids: Vec<RialtoHeaderId>,
mut headers: HeadersBatch,
) -> Option<RpcError> {
debug_assert_eq!(ids.len(), headers.len(),);
debug_assert_eq!(ids.len(), headers.len());
// if parent of first header is either incomplete, or rejected, we assume that contract
// will reject this header as well
......
......@@ -680,7 +680,7 @@ pub(crate) mod tests {
&target,
test_transaction_hash(0),
))
.is_err(),);
.is_err());
assert!(target.data.lock().submitted_proofs.is_empty());
}
......@@ -861,7 +861,7 @@ pub(crate) mod tests {
failed: 1,
}),
);
assert_eq!(target.data.lock().submitted_proofs, vec![],);
assert_eq!(target.data.lock().submitted_proofs, vec![]);
}
#[test]
......
......@@ -456,25 +456,25 @@ fn prune_recent_finality_proofs_works() {
// when there's proof for justified header in the vec
let mut recent_finality_proofs = original_recent_finality_proofs.clone();
prune_recent_finality_proofs::<TestFinalitySyncPipeline>(10, &mut recent_finality_proofs, 1024);
assert_eq!(&original_recent_finality_proofs[1..], recent_finality_proofs,);
assert_eq!(&original_recent_finality_proofs[1..], recent_finality_proofs);
// when there are no proof for justified header in the vec
let mut recent_finality_proofs = original_recent_finality_proofs.clone();
prune_recent_finality_proofs::<TestFinalitySyncPipeline>(11, &mut recent_finality_proofs, 1024);
assert_eq!(&original_recent_finality_proofs[1..], recent_finality_proofs,);
assert_eq!(&original_recent_finality_proofs[1..], recent_finality_proofs);
// when there are too many entries after initial prune && they also need to be pruned
let mut recent_finality_proofs = original_recent_finality_proofs.clone();
prune_recent_finality_proofs::<TestFinalitySyncPipeline>(10, &mut recent_finality_proofs, 2);
assert_eq!(&original_recent_finality_proofs[3..], recent_finality_proofs,);
assert_eq!(&original_recent_finality_proofs[3..], recent_finality_proofs);
// when last entry is pruned
let mut recent_finality_proofs = original_recent_finality_proofs.clone();
prune_recent_finality_proofs::<TestFinalitySyncPipeline>(19, &mut recent_finality_proofs, 2);
assert_eq!(&original_recent_finality_proofs[5..], recent_finality_proofs,);
assert_eq!(&original_recent_finality_proofs[5..], recent_finality_proofs);
// when post-last entry is pruned
let mut recent_finality_proofs = original_recent_finality_proofs.clone();
prune_recent_finality_proofs::<TestFinalitySyncPipeline>(20, &mut recent_finality_proofs, 2);
assert_eq!(&original_recent_finality_proofs[5..], recent_finality_proofs,);
assert_eq!(&original_recent_finality_proofs[5..], recent_finality_proofs);
}
......@@ -374,7 +374,7 @@ fn source_reject_extra(method: &SourceMethod) {
fn target_accept_all_headers(method: &TargetMethod, data: &mut TargetData, requires_extra: bool) {
if let TargetMethod::SubmitHeaders(ref submitted) = method {
assert_eq!(submitted.iter().all(|header| header.extra().is_some()), requires_extra,);
assert_eq!(submitted.iter().all(|header| header.extra().is_some()), requires_extra);
data.submit_headers_result = Some(SubmittedHeaders {
submitted: submitted.iter().map(|header| header.id()).collect(),
......
......@@ -872,7 +872,7 @@ pub(crate) mod tests {
exit_receiver.into_future().map(|(_, _)| ()),
);
assert_eq!(result.submitted_messages_proofs, vec![(1..=1, None)],);
assert_eq!(result.submitted_messages_proofs, vec![(1..=1, None)]);
}
#[test]
......
......@@ -483,12 +483,12 @@ mod tests {
);
strategy.remove_le_nonces_from_source_queue(5);
assert_eq!(source_queue_nonces(&strategy.source_queue), vec![6, 7, 8, 9],);
assert_eq!(source_queue_nonces(&strategy.source_queue), vec![6, 7, 8, 9]);
strategy.remove_le_nonces_from_source_queue(9);
assert_eq!(source_queue_nonces(&strategy.source_queue), Vec::<MessageNonce>::new(),);
assert_eq!(source_queue_nonces(&strategy.source_queue), Vec::<MessageNonce>::new());
strategy.remove_le_nonces_from_source_queue(100);
assert_eq!(source_queue_nonces(&strategy.source_queue), Vec::<MessageNonce>::new(),);
assert_eq!(source_queue_nonces(&strategy.source_queue), Vec::<MessageNonce>::new());
}
}
......@@ -524,7 +524,7 @@ fn force_approve_works() {
.unwrap()
.approved_bitfield
.not_any());
assert_eq!(approved_hashes, vec![block_hash_b, block_hash_a],);
assert_eq!(approved_hashes, vec![block_hash_b, block_hash_a]);
}
#[test]
......
......@@ -502,7 +502,7 @@ pub(crate) async fn handle_new_head(
};
if let Some(up_to) = force_approve {
tracing::debug!(target: LOG_TARGET, ?block_hash, up_to, "Enacting force-approve",);
tracing::debug!(target: LOG_TARGET, ?block_hash, up_to, "Enacting force-approve");
let approved_hashes = crate::ops::force_approve(db, block_hash, up_to)
.map_err(|e| SubsystemError::with_origin("approval-voting", e))?;
......
......@@ -960,7 +960,7 @@ fn distribution_messages_for_activation(
let block_entry = match db.load_block_entry(&block_hash)? {
Some(b) => b,
None => {
tracing::warn!(target: LOG_TARGET, ?block_hash, "Missing block entry",);
tracing::warn!(target: LOG_TARGET, ?block_hash, "Missing block entry");
continue
},
......@@ -2222,7 +2222,7 @@ async fn launch_approval(
// Validation checked out. Issue an approval command. If the underlying service is unreachable,
// then there isn't anything we can do.
tracing::trace!(target: LOG_TARGET, ?candidate_hash, ?para_id, "Candidate Valid",);
tracing::trace!(target: LOG_TARGET, ?candidate_hash, ?para_id, "Candidate Valid");
let expected_commitments_hash = candidate.commitments_hash;
if commitments.hash() == expected_commitments_hash {
......
......@@ -707,7 +707,7 @@ fn note_block_backed(
) -> Result<(), Error> {
let candidate_hash = candidate.hash();
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate backed",);
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate backed");
if load_meta(db, config, &candidate_hash)?.is_none() {
let meta = CandidateMeta {
......@@ -748,7 +748,7 @@ fn note_block_included(
Some(mut meta) => {
let be_block = (BEBlockNumber(block.0), block.1);
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate included",);
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate included");
meta.state = match meta.state {
State::Unavailable(at) => {
......@@ -1194,7 +1194,7 @@ fn store_available_data(
subsystem.db.write(tx)?;
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Stored data and chunks",);
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Stored data and chunks");
Ok(())
}
......
......@@ -720,7 +720,7 @@ fn stored_data_kept_until_finalized() {
test_state.wait_for_pruning().await;
// At this point data should be gone from the store.
assert!(query_available_data(&mut virtual_overseer, candidate_hash).await.is_none(),);
assert!(query_available_data(&mut virtual_overseer, candidate_hash).await.is_none());
assert!(has_all_chunks(&mut virtual_overseer, candidate_hash, n_validators, false).await);
virtual_overseer
......@@ -964,9 +964,9 @@ fn forkfullness_works() {
available_data_2,
);
assert!(has_all_chunks(&mut virtual_overseer, candidate_1_hash, n_validators, true).await,);
assert!(has_all_chunks(&mut virtual_overseer, candidate_1_hash, n_validators, true).await);
assert!(has_all_chunks(&mut virtual_overseer, candidate_2_hash, n_validators, true).await,);
assert!(has_all_chunks(&mut virtual_overseer, candidate_2_hash, n_validators, true).await);
// Candidate 2 should now be considered unavailable and will be pruned.
test_state.clock.inc(test_state.pruning_config.keep_unavailable_for);
......@@ -977,24 +977,24 @@ fn forkfullness_works() {
available_data_1,
);
assert!(query_available_data(&mut virtual_overseer, candidate_2_hash).await.is_none(),);
assert!(query_available_data(&mut virtual_overseer, candidate_2_hash).await.is_none());
assert!(has_all_chunks(&mut virtual_overseer, candidate_1_hash, n_validators, true).await,);
assert!(has_all_chunks(&mut virtual_overseer, candidate_1_hash, n_validators, true).await);
assert!(has_all_chunks(&mut virtual_overseer, candidate_2_hash, n_validators, false).await,);
assert!(has_all_chunks(&mut virtual_overseer, candidate_2_hash, n_validators, false).await);
// Wait for longer than finalized blocks should be kept for
test_state.clock.inc(test_state.pruning_config.keep_finalized_for);
test_state.wait_for_pruning().await;
// Everything should be pruned now.
assert!(query_available_data(&mut virtual_overseer, candidate_1_hash).await.is_none(),);
assert!(query_available_data(&mut virtual_overseer, candidate_1_hash).await.is_none());
assert!(query_available_data(&mut virtual_overseer, candidate_2_hash).await.is_none(),);
assert!(query_available_data(&mut virtual_overseer, candidate_2_hash).await.is_none());
assert!(has_all_chunks(&mut virtual_overseer, candidate_1_hash, n_validators, false).await,);
assert!(has_all_chunks(&mut virtual_overseer, candidate_1_hash, n_validators, false).await);
assert!(has_all_chunks(&mut virtual_overseer, candidate_2_hash, n_validators, false).await,);
assert!(has_all_chunks(&mut virtual_overseer, candidate_2_hash, n_validators, false).await);
virtual_overseer
});
}
......
......@@ -481,7 +481,7 @@ mod tests {
.write(vec![BackendWriteOp::DeleteBlockEntry(block_entry.block_hash)])
.unwrap();
assert!(backend.load_block_entry(&block_entry.block_hash).unwrap().is_none(),);
assert!(backend.load_block_entry(&block_entry.block_hash).unwrap().is_none());
}
#[test]
......@@ -491,7 +491,7 @@ mod tests {
let mut backend = DbBackend::new(db, config);
assert!(backend.load_first_block_number().unwrap().is_none(),);
assert!(backend.load_first_block_number().unwrap().is_none());
backend
.write(vec![
......@@ -501,7 +501,7 @@ mod tests {
])
.unwrap();
assert_eq!(backend.load_first_block_number().unwrap(), Some(2),);
assert_eq!(backend.load_first_block_number().unwrap(), Some(2));
backend
.write(vec![
......@@ -510,7 +510,7 @@ mod tests {
])
.unwrap();
assert_eq!(backend.load_first_block_number().unwrap(), Some(10),);
assert_eq!(backend.load_first_block_number().unwrap(), Some(10));
}
#[test]
......@@ -521,7 +521,7 @@ mod tests {
let mut backend = DbBackend::new(db, config);
// Prove that it's cheap
assert!(backend.load_stagnant_at_up_to(Timestamp::max_value()).unwrap().is_empty(),);
assert!(backend.load_stagnant_at_up_to(Timestamp::max_value()).unwrap().is_empty());
backend
.write(vec![
......@@ -584,9 +584,9 @@ mod tests {
])
.unwrap();
assert_eq!(backend.load_blocks_by_number(2).unwrap(), vec![Hash::repeat_byte(1)],);
assert_eq!(backend.load_blocks_by_number(2).unwrap(), vec![Hash::repeat_byte(1)]);
assert_eq!(backend.load_blocks_by_number(3).unwrap(), vec![],);
assert_eq!(backend.load_blocks_by_number(3).unwrap(), vec![]);
backend
.write(vec![
......@@ -595,10 +595,10 @@ mod tests {
])
.unwrap();
assert_eq!(backend.load_blocks_by_number(2).unwrap(), vec![],);
assert_eq!(backend.load_blocks_by_number(2).unwrap(), vec![]);
assert_eq!(backend.load_blocks_by_number(5).unwrap(), vec![],);
assert_eq!(backend.load_blocks_by_number(5).unwrap(), vec![]);
assert_eq!(backend.load_blocks_by_number(10).unwrap(), vec![Hash::repeat_byte(3)],);
assert_eq!(backend.load_blocks_by_number(10).unwrap(), vec![Hash::repeat_byte(3)]);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment