diff --git a/src/rstd/collections/stack.rs b/src/rstd/collections/stack.rs index 4836e44..27e859b 100644 --- a/src/rstd/collections/stack.rs +++ b/src/rstd/collections/stack.rs @@ -54,6 +54,12 @@ pub enum StackParseError<ElementParseError: Error> { Element(ElementParseError), } +impl<E: Error> From<PointParseError> for StackParseError<E> { + fn from(value: PointParseError) -> Self { + Self::Point(value) + } +} + impl<ElementParseError: Error> Display for StackParseError<ElementParseError> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { @@ -75,9 +81,7 @@ impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx>> Factory<'a, Ctx> for StackNodeFa type ParseError = StackParseError<ParseError<'a, Ctx, F>>; fn deserialize(&self, inctx: impl InCtx<'a, Ctx>) -> ParseResult<'a, Ctx, Self> { - let (rest, inctx) = NullableFactory::new(self.clone()) - .ideserialize(inctx) - .map_err(StackParseError::Point)?; + let (rest, inctx) = NullableFactory::new(self.clone()).ideserialize(inctx)?; let element = self .element_factory .deserialize(inctx) @@ -169,9 +173,7 @@ impl<'a, Ctx: Context<'a>, F: InlineableFactory<'a, Ctx>> InlineableFactory<'a, } fn ideserialize<I: InCtx<'a, Ctx>>(&self, inctx: I) -> IParseResult<'a, Ctx, Self, I> { - let (rest, inctx) = NullableFactory::new(self.clone()) - .ideserialize(inctx) - .map_err(StackParseError::Point)?; + let (rest, inctx) = NullableFactory::new(self.clone()).ideserialize(inctx)?; let (element, inctx) = self .element_factory .ideserialize(inctx)