Diffstat (limited to 'src/build/builders/core/struct.rs')
| -rw-r--r-- | src/build/builders/core/struct.rs | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/build/builders/core/struct.rs b/src/build/builders/core/struct.rs index 242f6a4..9ff1862 100644 --- a/src/build/builders/core/struct.rs +++ b/src/build/builders/core/struct.rs @@ -163,7 +163,7 @@ impl<'ctx, Info, Mode: 'ctx, E: Effect> StructBuilder<'ctx, Info, Mode, E> where Info: StructTypeInfo<'ctx, Mode>, { - fn into_builders<'e>(&mut self) -> ErasedEffective<'e, (), E> + fn make_builders<'e>(&mut self) -> ErasedEffective<'e, (), E> where 'ctx: 'e, { @@ -330,13 +330,10 @@ where walker: DynWalkerObjSafe<'walker, 'ctx, E>, ) -> ErasedEffective<'e, VisitResult<DynWalkerObjSafe<'walker, 'ctx, E>>, E> { // If this protocol is used then we need to create the builders. - E::as_ctx(self, |this| this.into_builders().cast()).then(|(this, _)| { - match &mut this.inner { - Inner::Builders { kind, .. } => { - // This signals to go into map mode for the sequence. - *kind = StructKind::Map; - } - _ => {} + E::as_ctx(self, |this| this.make_builders().cast()).then(|(this, _)| { + if let Inner::Builders { kind, .. } = &mut this.inner { + // This signals to go into map mode for the sequence. + *kind = StructKind::Map; } // Walk the walker so nothing complains. @@ -359,13 +356,10 @@ where walker: DynWalkerObjSafe<'walker, 'ctx, E>, ) -> ErasedEffective<'e, VisitResult<DynWalkerObjSafe<'walker, 'ctx, E>>, E> { // If this protocol is used then we need to create the builders. - E::as_ctx(self, |this| this.into_builders().cast()).then(|(this, _)| { - match &mut this.inner { - Inner::Builders { kind, .. } => { - // This signals to go into map mode for the sequence. - *kind = StructKind::Map; - } - _ => {} + E::as_ctx(self, |this| this.make_builders().cast()).then(|(this, _)| { + if let Inner::Builders { kind, .. } = &mut this.inner { + // This signals to go into map mode for the sequence. + *kind = StructKind::Map; } // Walk the walker so nothing complains. @@ -393,7 +387,7 @@ where 'ctx: 'a + 'b + 'c, { // If this protocol is used then we need to create the builders. - E::as_ctx(self, |this| this.into_builders().cast()) + E::as_ctx(self, |this| this.make_builders().cast()) .as_ctx(|(this, _)| { match &mut this.inner { // We should treat the sequence as just values. |