mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
[refactor] Refactor Option/Result combinators (#3180)
Code simplifications using `Option`/`Result` combinators to make pattern-matches a tad simpler. Opinions on these loosely held, happy to adjust in review. Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).
This commit is contained in:
@@ -121,8 +121,7 @@ impl ApiTester {
|
||||
harness.chain.slot().unwrap(),
|
||||
)
|
||||
.into_iter()
|
||||
.map(|vec| vec.into_iter().map(|(attestation, _subnet_id)| attestation))
|
||||
.flatten()
|
||||
.flat_map(|vec| vec.into_iter().map(|(attestation, _subnet_id)| attestation))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assert!(
|
||||
@@ -244,8 +243,7 @@ impl ApiTester {
|
||||
harness.chain.slot().unwrap(),
|
||||
)
|
||||
.into_iter()
|
||||
.map(|vec| vec.into_iter().map(|(attestation, _subnet_id)| attestation))
|
||||
.flatten()
|
||||
.flat_map(|vec| vec.into_iter().map(|(attestation, _subnet_id)| attestation))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let attester_slashing = harness.make_attester_slashing(vec![0, 1]);
|
||||
@@ -2390,8 +2388,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
let attesting_validators: Vec<usize> = committees
|
||||
.into_iter()
|
||||
.map(|committee| committee.committee.iter().cloned())
|
||||
.flatten()
|
||||
.flat_map(|committee| committee.committee.iter().cloned())
|
||||
.collect();
|
||||
// All attesters should now be considered live
|
||||
let expected = expected
|
||||
|
||||
Reference in New Issue
Block a user