feat(nix-compat/derivation): use #[from] for Error::Parser
Change-Id: Ic21142200d82d81dd3bc61d21bfa833e5ad88128 Reviewed-on: https://cl.tvl.fyi/c/depot/+/13195 Reviewed-by: Brian Olsen <me@griff.name> Tested-by: BuildkiteCI
This commit is contained in:
parent
d031c2ef4e
commit
8347bd20b0
1 changed files with 2 additions and 2 deletions
|
|
@ -20,7 +20,7 @@ use crate::{aterm, nixhash};
|
|||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error<I> {
|
||||
#[error("parsing error: {0}")]
|
||||
Parser(NomError<I>),
|
||||
Parser(#[from] NomError<I>),
|
||||
#[error("premature EOF")]
|
||||
Incomplete,
|
||||
#[error("validation error: {0}")]
|
||||
|
|
@ -39,7 +39,7 @@ pub(crate) fn parse(i: &[u8]) -> Result<Derivation, Error<&[u8]>> {
|
|||
Ok(derivation)
|
||||
}
|
||||
Err(nom::Err::Incomplete(_)) => Err(Error::Incomplete),
|
||||
Err(nom::Err::Error(e) | nom::Err::Failure(e)) => Err(Error::Parser(e)),
|
||||
Err(nom::Err::Error(e) | nom::Err::Failure(e)) => Err(e.into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue