ci_event: infallible constructors
I was browsing through the code when I noticed that some of these constructors are infallible, e.g.
pub fn patch_created(
from_node: NodeId,
repo: RepoId,
patch: PatchId,
tip: Oid,
) -> Result<Self, CiEventError> {
Ok(Self::V1(CiEventV1::PatchCreated {
from_node,
repo,
patch,
new_tip: tip,
}))
}
pub fn patch_updated(
from_node: NodeId,
repo: RepoId,
patch: PatchId,
new_tip: Oid,
) -> Result<Self, CiEventError> {
Ok(Self::V1(CiEventV1::PatchUpdated {
from_node,
repo,
patch,
new_tip,
}))
}
I was wondering why you’d want to do this when the calling code can just construct it safely?
I’ve not left a comment for myself, so this is retconning: I think it’s for consistency with the branch related constructors. Not sure that’s worth it.
Refactored this code to drop the Results from constructors that don’t need them. Thanks.