From 82768a371732360755e62d4241f94073ecba9bc7 Mon Sep 17 00:00:00 2001 From: ysthakur <45539777+ysthakur@users.noreply.github.com> Date: Sun, 14 Jan 2024 12:19:18 -0500 Subject: [PATCH] refactor: Make size of parser_deser::error::Error smaller --- src/gen/carapace.rs | 2 +- src/parse_deser/error.rs | 2 +- src/parse_deser/mod.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gen/carapace.rs b/src/gen/carapace.rs index 81aadeb..c022bd7 100644 --- a/src/gen/carapace.rs +++ b/src/gen/carapace.rs @@ -38,7 +38,7 @@ impl Completion { /// Generate a Carapace spec from a [`CommandInfo`] pub fn generate(cmd: &CommandInfo) -> String { - let yaml = serde_yaml::to_string(&to_carapace(&cmd)) + let yaml = serde_yaml::to_string(&to_carapace(cmd)) .expect("Carapace spec should've been serialized to YAML"); format!("{}\n{}", HEADER, yaml) } diff --git a/src/parse_deser/error.rs b/src/parse_deser/error.rs index 9742b42..bc38a4a 100644 --- a/src/parse_deser/error.rs +++ b/src/parse_deser/error.rs @@ -29,7 +29,7 @@ pub enum Error { #[source_code] source_code: NamedSource, #[source] - error: DeserError, + error: Box, }, } diff --git a/src/parse_deser/mod.rs b/src/parse_deser/mod.rs index 06ceec9..c94a3c0 100644 --- a/src/parse_deser/mod.rs +++ b/src/parse_deser/mod.rs @@ -36,7 +36,7 @@ pub fn parse(file: impl AsRef) -> Result { }; parse_from_str(&text, format).map_err(|error| Error::Deser { source_code: NamedSource::new(file_path, text), - error, + error: Box::new(error), }) } else { Err(Error::UnrecognizableExtension { file_path })