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

Commit

Permalink
Remove extra commas made redundent after rustfmt (#9404)
Browse files Browse the repository at this point in the history
* Remove extra commas made redundent after rustfmt
  • Loading branch information
gilescope authored Jul 22, 2021
1 parent fced297 commit 7dcc77b
Show file tree
Hide file tree
Showing 101 changed files with 309 additions and 309 deletions.
4 changes: 2 additions & 2 deletions bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ fn full_native_block_import_works() {
Balances::total_balance(&alice()),
alice_last_known_balance - 10 * DOLLARS - fees,
);
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - fees,);
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - fees);
let events = vec![
EventRecord {
phase: Phase::ApplyExtrinsic(0),
Expand Down Expand Up @@ -529,7 +529,7 @@ fn full_wasm_block_import_works() {
Balances::total_balance(&alice()),
alice_last_known_balance - 10 * DOLLARS - fees,
);
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - 1 * fees,);
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - 1 * fees);
});
}

Expand Down
4 changes: 2 additions & 2 deletions bin/utils/chain-spec-builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn print_seeds(
println!("{}", header.paint("Authority seeds"));

for (n, seed) in authority_seeds.iter().enumerate() {
println!("{} //{}", entry.paint(format!("auth-{}:", n)), seed,);
println!("{} //{}", entry.paint(format!("auth-{}:", n)), seed);
}

println!("{}", header.paint("Nominator seeds"));
Expand All @@ -217,7 +217,7 @@ fn print_seeds(
if !endowed_seeds.is_empty() {
println!("{}", header.paint("Endowed seeds"));
for (n, seed) in endowed_seeds.iter().enumerate() {
println!("{} //{}", entry.paint(format!("endowed-{}:", n)), seed,);
println!("{} //{}", entry.paint(format!("endowed-{}:", n)), seed);
}

println!();
Expand Down
6 changes: 3 additions & 3 deletions client/authority-discovery/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,15 @@ where

if log_enabled!(log::Level::Debug) {
let hashes: Vec<_> = v.iter().map(|(hash, _value)| hash.clone()).collect();
debug!(target: LOG_TARGET, "Value for hash '{:?}' found on Dht.", hashes,);
debug!(target: LOG_TARGET, "Value for hash '{:?}' found on Dht.", hashes);
}

if let Err(e) = self.handle_dht_value_found_event(v) {
if let Some(metrics) = &self.metrics {
metrics.handle_value_found_event_failure.inc();
}

debug!(target: LOG_TARGET, "Failed to handle Dht value found event: {:?}", e,);
debug!(target: LOG_TARGET, "Failed to handle Dht value found event: {:?}", e);
}
},
DhtEvent::ValueNotFound(hash) => {
Expand All @@ -456,7 +456,7 @@ where
metrics.dht_event_received.with_label_values(&["value_put"]).inc();
}

debug!(target: LOG_TARGET, "Successfully put hash '{:?}' on Dht.", hash,)
debug!(target: LOG_TARGET, "Successfully put hash '{:?}' on Dht.", hash)
},
DhtEvent::ValuePutFailed(hash) => {
if let Some(metrics) = &self.metrics {
Expand Down
2 changes: 1 addition & 1 deletion client/cli/src/params/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl FromStr for GenericNumber {

fn from_str(block_number: &str) -> Result<Self, Self::Err> {
if let Some(pos) = block_number.chars().position(|d| !d.is_digit(10)) {
Err(format!("Expected block number, found illegal digit at position: {}", pos,))
Err(format!("Expected block number, found illegal digit at position: {}", pos))
} else {
Ok(Self(block_number.to_owned()))
}
Expand Down
2 changes: 1 addition & 1 deletion client/cli/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl<C: SubstrateCli> Runner<C> {
pub fn print_node_infos<C: SubstrateCli>(config: &Configuration) {
info!("{}", C::impl_name());
info!("✌️ version {}", C::impl_version());
info!("❤️ by {}, {}-{}", C::author(), C::copyright_start_year(), Local::today().year(),);
info!("❤️ by {}, {}-{}", C::author(), C::copyright_start_year(), Local::today().year());
info!("📋 Chain specification: {}", config.chain_spec.name());
info!("🏷 Node name: {}", config.network.node_name);
info!("👤 Role: {}", config.display_role());
Expand Down
4 changes: 2 additions & 2 deletions client/consensus/babe/src/aux_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ mod test {
)
.unwrap();

assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), None,);
assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), None);

let epoch_changes = load_epoch_changes::<TestBlock, _>(
&client,
Expand Down Expand Up @@ -202,6 +202,6 @@ mod test {
client.insert_aux(values, &[]).unwrap();
});

assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), Some(2),);
assert_eq!(load_decode::<_, u32>(&client, BABE_EPOCH_CHANGES_VERSION).unwrap(), Some(2));
}
}
4 changes: 2 additions & 2 deletions client/consensus/babe/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,10 +780,10 @@ fn importing_epoch_change_block_prunes_tree() {
let fork_3 = propose_and_import_blocks(BlockId::Hash(canon_hashes[18]), 10);

// We should be tracking a total of 9 epochs in the fork tree
assert_eq!(epoch_changes.shared_data().tree().iter().count(), 9,);
assert_eq!(epoch_changes.shared_data().tree().iter().count(), 9);

// And only one root
assert_eq!(epoch_changes.shared_data().tree().roots().count(), 1,);
assert_eq!(epoch_changes.shared_data().tree().roots().count(), 1);

// We finalize block #13 from the canon chain, so on the next epoch
// change the tree should be pruned, to not contain F (#7).
Expand Down
8 changes: 4 additions & 4 deletions client/consensus/slots/src/aux_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,21 @@ mod test {
let header6 = create_header(3); // @ slot 4

// It's ok to sign same headers.
assert!(check_equivocation(&client, 2.into(), 2.into(), &header1, &public,)
assert!(check_equivocation(&client, 2.into(), 2.into(), &header1, &public)
.unwrap()
.is_none(),);

assert!(check_equivocation(&client, 3.into(), 2.into(), &header1, &public,)
assert!(check_equivocation(&client, 3.into(), 2.into(), &header1, &public)
.unwrap()
.is_none(),);

// But not two different headers at the same slot.
assert!(check_equivocation(&client, 4.into(), 2.into(), &header2, &public,)
assert!(check_equivocation(&client, 4.into(), 2.into(), &header2, &public)
.unwrap()
.is_some(),);

// Different slot is ok.
assert!(check_equivocation(&client, 5.into(), 4.into(), &header3, &public,)
assert!(check_equivocation(&client, 5.into(), 4.into(), &header3, &public)
.unwrap()
.is_none(),);

Expand Down
6 changes: 3 additions & 3 deletions client/consensus/slots/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
let proposal = match futures::future::select(proposing, proposing_remaining).await {
Either::Left((Ok(p), _)) => p,
Either::Left((Err(err), _)) => {
warn!(target: logging_target, "Proposing failed: {:?}", err,);
warn!(target: logging_target, "Proposing failed: {:?}", err);

return None
},
Expand Down Expand Up @@ -363,7 +363,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
) {
Ok(bi) => bi,
Err(err) => {
warn!(target: logging_target, "Failed to create block import params: {:?}", err,);
warn!(target: logging_target, "Failed to create block import params: {:?}", err);

return None
},
Expand Down Expand Up @@ -922,7 +922,7 @@ mod test {
}

// but we cap it to a maximum of 20 slots
assert_eq!(super::slot_lenience_linear(1u64.into(), &slot(23)), Some(SLOT_DURATION * 20),);
assert_eq!(super::slot_lenience_linear(1u64.into(), &slot(23)), Some(SLOT_DURATION * 20));
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/slots/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn duration_now() -> Duration {
use std::time::SystemTime;
let now = SystemTime::now();
now.duration_since(SystemTime::UNIX_EPOCH).unwrap_or_else(|e| {
panic!("Current time {:?} is before unix epoch. Something is wrong: {:?}", now, e,)
panic!("Current time {:?} is before unix epoch. Something is wrong: {:?}", now, e)
})
}

Expand Down
16 changes: 8 additions & 8 deletions client/db/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1155,39 +1155,39 @@ pub(crate) mod tests {

let hash7 =
insert_block(&db, make_authorities(vec![auth3()]), || default_header(&hash6, 7));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
let hash8 =
insert_block(&db, make_authorities(vec![auth3()]), || default_header(&hash7, 8));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
let hash6_1 =
insert_block(&db, make_authorities(vec![auth4()]), || default_header(&hash6, 7));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
let hash6_1_1 = insert_non_best_block(&db, make_authorities(vec![auth5()]), || {
default_header(&hash6_1, 8)
});
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1_1)), Some(vec![auth5()]));
let hash6_1_2 = insert_non_best_block(&db, make_authorities(vec![auth6()]), || {
default_header(&hash6_1, 8)
});
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1_1)), Some(vec![auth5()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1_2)), Some(vec![auth6()]));
let hash6_2 =
insert_block(&db, make_authorities(vec![auth4()]), || default_header(&hash6_1, 8));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), Some(vec![auth3()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
Expand All @@ -1201,7 +1201,7 @@ pub(crate) mod tests {
{
// finalize block hash6_1
db.finalize_header(BlockId::Hash(hash6_1)).unwrap();
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), None);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), None);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
Expand All @@ -1210,7 +1210,7 @@ pub(crate) mod tests {
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_2)), Some(vec![auth4()]));
// finalize block hash6_2
db.finalize_header(BlockId::Hash(hash6_2)).unwrap();
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]),);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6)), Some(vec![auth1(), auth2()]));
assert_eq!(authorities(db.cache(), BlockId::Hash(hash7)), None);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash8)), None);
assert_eq!(authorities(db.cache(), BlockId::Hash(hash6_1)), Some(vec![auth4()]));
Expand Down
6 changes: 3 additions & 3 deletions client/executor/src/integration_tests/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn sandbox_should_work(wasm_method: WasmExecutionMethod) {
.unwrap()
.encode();

assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), true.encode(),);
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext).unwrap(), true.encode());
}

test_wasm_execution!(sandbox_trap);
Expand All @@ -72,7 +72,7 @@ fn sandbox_trap(wasm_method: WasmExecutionMethod) {
)
.unwrap();

assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), vec![0],);
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext).unwrap(), vec![0]);
}

test_wasm_execution!(start_called);
Expand Down Expand Up @@ -111,7 +111,7 @@ fn start_called(wasm_method: WasmExecutionMethod) {
.unwrap()
.encode();

assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext,).unwrap(), true.encode(),);
assert_eq!(call_in_wasm("test_sandbox", &code, wasm_method, &mut ext).unwrap(), true.encode());
}

test_wasm_execution!(invoke_args);
Expand Down
2 changes: 1 addition & 1 deletion client/executor/src/native_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ mod tests {
fn native_executor_registers_custom_interface() {
let executor = NativeExecutor::<MyExecutor>::new(WasmExecutionMethod::Interpreted, None, 8);
my_interface::HostFunctions::host_functions().iter().for_each(|function| {
assert_eq!(executor.wasm.host_functions.iter().filter(|f| f == &function).count(), 2,);
assert_eq!(executor.wasm.host_functions.iter().filter(|f| f == &function).count(), 2);
});

my_interface::say_hello_world("hey");
Expand Down
2 changes: 1 addition & 1 deletion client/executor/wasmtime/src/instance_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl InstanceWrapper {
.ok_or_else(|| Error::from(format!("Export {} is not a function", method)))?
.clone();
EntryPoint::direct(func).map_err(|_| {
Error::from(format!("Exported function '{}' has invalid signature.", method,))
Error::from(format!("Exported function '{}' has invalid signature.", method))
})?
},
InvokeMethod::Table(func_ref) => {
Expand Down
20 changes: 10 additions & 10 deletions client/finality-grandpa/src/authorities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,13 +780,13 @@ mod tests {
authorities.add_pending_change(change(1), &is_descendent_of).unwrap();
authorities.add_pending_change(change(2), &is_descendent_of).unwrap();

assert_eq!(authorities.current_limit(0), Some(1),);
assert_eq!(authorities.current_limit(0), Some(1));

assert_eq!(authorities.current_limit(1), Some(1),);
assert_eq!(authorities.current_limit(1), Some(1));

assert_eq!(authorities.current_limit(2), Some(2),);
assert_eq!(authorities.current_limit(2), Some(2));

assert_eq!(authorities.current_limit(3), None,);
assert_eq!(authorities.current_limit(3), None);
}

#[test]
Expand Down Expand Up @@ -910,7 +910,7 @@ mod tests {
.add_pending_change(change_b.clone(), &static_is_descendent_of(true))
.unwrap();

assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a, &change_b],);
assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a, &change_b]);

// finalizing "hash_c" won't enact the change signaled at "hash_a" but it will prune out "hash_b"
let status = authorities
Expand All @@ -929,7 +929,7 @@ mod tests {

assert!(status.changed);
assert_eq!(status.new_set_block, None);
assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a],);
assert_eq!(authorities.pending_changes().collect::<Vec<_>>(), vec![&change_a]);
assert_eq!(authorities.authority_set_changes, AuthoritySetChanges::empty());

// finalizing "hash_d" will enact the change signaled at "hash_a"
Expand Down Expand Up @@ -1444,7 +1444,7 @@ mod tests {
);

// there's no longer any pending change at `best_b` fork
assert_eq!(authorities.next_change(&"best_b", &is_descendent_of).unwrap(), None,);
assert_eq!(authorities.next_change(&"best_b", &is_descendent_of).unwrap(), None);

// we a forced change at A10 (#8)
let change_a10 = PendingChange {
Expand Down Expand Up @@ -1666,7 +1666,7 @@ mod tests {
authority_set_changes.append(2, 81);

// we are missing the data for the first set, therefore we should return `None`
assert_eq!(None, authority_set_changes.iter_from(40).map(|it| it.collect::<Vec<_>>()),);
assert_eq!(None, authority_set_changes.iter_from(40).map(|it| it.collect::<Vec<_>>()));

// after adding the data for the first set the same query should work
let mut authority_set_changes = AuthoritySetChanges::empty();
Expand All @@ -1685,8 +1685,8 @@ mod tests {
authority_set_changes.iter_from(41).map(|it| it.cloned().collect::<Vec<_>>()),
);

assert_eq!(0, authority_set_changes.iter_from(121).unwrap().count(),);
assert_eq!(0, authority_set_changes.iter_from(121).unwrap().count());

assert_eq!(0, authority_set_changes.iter_from(200).unwrap().count(),);
assert_eq!(0, authority_set_changes.iter_from(200).unwrap().count());
}
}
Loading

0 comments on commit 7dcc77b

Please sign in to comment.