Convert tuple enum variant into struct variant

This commit is contained in:
Hanno Braun 2023-12-21 20:40:28 +01:00
parent cf77d924ea
commit 03606366f8

View File

@ -47,10 +47,16 @@ pub enum ShellValidationError {
#[error( #[error(
"`Shell` contains `HalfEdge`s that are coincident but are not \ "`Shell` contains `HalfEdge`s that are coincident but are not \
siblings\n\ siblings\n\
Half-edge 1: {0:#?}\n\ Half-edge 1: {half_edge_a:#?}\n\
Half-edge 2: {1:#?}" Half-edge 2: {half_edge_b:#?}"
)] )]
CoincidentHalfEdgesAreNotSiblings(Handle<HalfEdge>, Handle<HalfEdge>), CoincidentHalfEdgesAreNotSiblings {
/// The first half-edge
half_edge_a: Handle<HalfEdge>,
/// The second half-edge
half_edge_b: Handle<HalfEdge>,
},
} }
impl ShellValidationError { impl ShellValidationError {
@ -226,10 +232,10 @@ impl ShellValidationError {
.all(|d| d < config.distinct_min_distance) .all(|d| d < config.distinct_min_distance)
{ {
errors.push( errors.push(
Self::CoincidentHalfEdgesAreNotSiblings( Self::CoincidentHalfEdgesAreNotSiblings {
half_edge_a.clone(), half_edge_a: half_edge_a.clone(),
half_edge_b.clone(), half_edge_b: half_edge_b.clone(),
) }
.into(), .into(),
) )
} }
@ -395,7 +401,7 @@ mod tests {
assert_contains_err!( assert_contains_err!(
invalid, invalid,
ValidationError::Shell( ValidationError::Shell(
ShellValidationError::CoincidentHalfEdgesAreNotSiblings(..) ShellValidationError::CoincidentHalfEdgesAreNotSiblings { .. }
) )
); );