Change style of `infer_surface_form`

This commit is contained in:
Hanno Braun 2022-11-11 16:42:51 +01:00
parent 807f824746
commit 6f8f06f261
3 changed files with 6 additions and 7 deletions

View File

@ -11,11 +11,11 @@ use crate::{
/// Builder API for [`PartialVertex`]
pub trait VertexBuilder {
/// Remove the surface form of the partial vertex, inferring it on build
fn infer_surface_form(self) -> Self;
fn infer_surface_form(&mut self) -> &mut Self;
}
impl VertexBuilder for PartialVertex {
fn infer_surface_form(mut self) -> Self {
fn infer_surface_form(&mut self) -> &mut Self {
self.surface_form = PartialSurfaceVertex::default().into();
self
}

View File

@ -95,7 +95,8 @@ mod tests {
// Sever connection between the last and first half-edge in the
// cycle.
let first_vertex = first_vertex.into_partial().infer_surface_form();
let mut first_vertex = first_vertex.into_partial();
first_vertex.infer_surface_form();
*first_half_edge = first_half_edge
.clone()
.with_back_vertex(first_vertex)

View File

@ -308,10 +308,8 @@ mod tests {
|vertex| -> anyhow::Result<_, ValidationError> {
let mut vertex = vertex.to_partial();
vertex.position = Some([0.].into());
Ok(vertex
.infer_surface_form()
.build(&objects)?
.insert(&objects)?)
vertex.infer_surface_form();
Ok(vertex.build(&objects)?.insert(&objects)?)
},
)?,
valid.global_form().clone(),