Skip to content

Commit e777fca

Browse files
committed
Flatten the code in chain combinator
1 parent 59fa85b commit e777fca

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

manul/src/combinators/chain.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -436,37 +436,30 @@ where
436436
FinalizeOutcome::Result(result) => {
437437
let entry_point2 = transition.make_entry_point2(result);
438438
let round = entry_point2.make_round(rng, &shared_randomness, &id)?;
439-
440-
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(ChainedRound::<
441-
Id,
442-
T,
443-
> {
439+
let chained_round = ChainedRound::<Id, T> {
444440
state: ChainState::Protocol2(round),
445-
})))
441+
};
442+
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(chained_round)))
446443
}
447444
FinalizeOutcome::AnotherRound(round) => {
448-
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(ChainedRound::<
449-
Id,
450-
T,
451-
> {
445+
let chained_round = ChainedRound::<Id, T> {
452446
state: ChainState::Protocol1 {
453447
id,
454448
shared_randomness,
455449
round,
456450
transition,
457451
},
458-
})))
452+
};
453+
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(chained_round)))
459454
}
460455
},
461456
ChainState::Protocol2(round) => match round.into_boxed().finalize(rng, payloads, artifacts)? {
462457
FinalizeOutcome::Result(result) => Ok(FinalizeOutcome::Result(result)),
463458
FinalizeOutcome::AnotherRound(round) => {
464-
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(ChainedRound::<
465-
Id,
466-
T,
467-
> {
459+
let chained_round = ChainedRound::<Id, T> {
468460
state: ChainState::Protocol2(round),
469-
})))
461+
};
462+
Ok(FinalizeOutcome::AnotherRound(BoxedRound::new_dynamic(chained_round)))
470463
}
471464
},
472465
}

0 commit comments

Comments
 (0)