From d8c82837822b968b57dbf7394501ee4df8e31b7a Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 9 Oct 2022 10:25:09 -0700 Subject: [PATCH] revset: wrap pest error in a `Box`, to keep type small A newer version of Clippy starts complianing that the type is too large (>=184 bytes) otherwise. --- lib/src/revset.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/revset.rs b/lib/src/revset.rs index f2cb9e37f..0806047e3 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -191,7 +191,7 @@ pub struct RevsetParser; #[derive(Debug, Error, PartialEq, Eq)] pub enum RevsetParseError { #[error("{0}")] - SyntaxError(#[from] pest::error::Error), + SyntaxError(#[from] Box>), #[error("Revset function \"{0}\" doesn't exist")] NoSuchFunction(String), #[error("Invalid arguments to revset function \"{name}\": {message}")] @@ -794,7 +794,8 @@ fn parse_function_argument_to_string( } pub fn parse(revset_str: &str) -> Result, RevsetParseError> { - let mut pairs = RevsetParser::parse(Rule::expression, revset_str)?; + let mut pairs = RevsetParser::parse(Rule::expression, revset_str) + .map_err(|err| RevsetParseError::SyntaxError(Box::new(err)))?; let first = pairs.next().unwrap(); assert!(pairs.next().is_none()); if first.as_span().end() != revset_str.len() { @@ -805,7 +806,7 @@ pub fn parse(revset_str: &str) -> Result, RevsetParseError> }, pos, ); - return Err(RevsetParseError::SyntaxError(err)); + return Err(RevsetParseError::SyntaxError(Box::new(err))); } parse_expression_rule(first.into_inner())