diff --git a/src/metadata/error.rs b/src/metadata/error.rs index e3ae9d4a..d74cbfe8 100644 --- a/src/metadata/error.rs +++ b/src/metadata/error.rs @@ -1,6 +1,7 @@ //! Holds all error types related to LOOT metadata. use std::path::PathBuf; +use fancy_regex::Error as RegexImplError; use saphyr::Marker; use crate::metadata::MessageContent; @@ -124,7 +125,7 @@ impl From for ParseMetadataError { pub(super) enum MetadataParsingErrorReason { InvalidCondition(Box<(String, loot_condition_interpreter::Error)>), MissingKey(&'static str, YamlObjectType), - InvalidRegex(Box), + InvalidRegex(Box), InvalidMultilingualMessageContents, UnexpectedType(ExpectedType, YamlObjectType), UnexpectedValueType(&'static str, ExpectedType, YamlObjectType), @@ -209,7 +210,7 @@ impl std::fmt::Display for ExpectedType { /// Represents an error encountered while parsing and compiling a regex plugin /// name. #[derive(Clone, Debug)] -pub struct RegexError(Box); +pub struct RegexError(Box); impl std::fmt::Display for RegexError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -223,8 +224,8 @@ impl std::error::Error for RegexError { } } -impl From> for RegexError { - fn from(value: Box) -> Self { +impl From> for RegexError { + fn from(value: Box) -> Self { Self(value) } } diff --git a/src/metadata/plugin_metadata.rs b/src/metadata/plugin_metadata.rs index 38316265..c8659f06 100644 --- a/src/metadata/plugin_metadata.rs +++ b/src/metadata/plugin_metadata.rs @@ -1,6 +1,6 @@ use std::sync::LazyLock; -use fancy_regex::{Captures, Regex}; +use fancy_regex::{Captures, Error as RegexImplError, Regex}; use saphyr::MarkedYaml; use crate::logging; @@ -219,7 +219,7 @@ struct PluginName { } impl PluginName { - fn new(name: &str) -> Result> { + fn new(name: &str) -> Result> { let name = trim_dot_ghost(name).to_string(); if is_regex_name(&name) { diff --git a/src/plugin/error.rs b/src/plugin/error.rs index 78cee23c..7bef946a 100644 --- a/src/plugin/error.rs +++ b/src/plugin/error.rs @@ -1,5 +1,7 @@ use std::path::PathBuf; +use fancy_regex::Error as RegexImplError; + /// Represents an error that occurred while reading a parsed plugin's data. #[derive(Debug)] pub struct PluginDataError(esplugin::Error); @@ -28,7 +30,7 @@ pub(crate) enum LoadPluginError { InvalidFilename(InvalidFilenameReason), IoError(std::io::Error), ParsingError(esplugin::Error), - RegexError(Box), + RegexError(Box), } impl std::fmt::Display for LoadPluginError { @@ -65,8 +67,8 @@ impl From for LoadPluginError { } } -impl From> for LoadPluginError { - fn from(value: Box) -> Self { +impl From> for LoadPluginError { + fn from(value: Box) -> Self { LoadPluginError::RegexError(value) } } diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs index cb476832..c2183771 100644 --- a/src/plugin/mod.rs +++ b/src/plugin/mod.rs @@ -10,7 +10,7 @@ use std::{ }; use esplugin::ParseOptions; -use fancy_regex::Regex; +use fancy_regex::{Error as RegexImplError, Regex}; use crate::{ GameType, @@ -410,7 +410,7 @@ fn extract_bash_tags(description: &str) -> Vec { Vec::new() } -fn extract_version(description: &str) -> Result, Box> { +fn extract_version(description: &str) -> Result, Box> { static VERSION_REGEXES: LazyLock> = LazyLock::new(|| { // The string below matches the range of version strings supported by // Pseudosem v1.0.1, excluding space separators, as they make version