From 45916f032a7fbbd30f8d3dac2870a837d2c4684f Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 7 Jan 2023 13:19:11 +0200 Subject: refactor: box value in ParserError::Wikitext Sponsored-by: author --- src/parser.rs | 8 +------- src/site.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 83be505..5e8238e 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -10,7 +10,7 @@ pub enum ParserError { WikitextSyntax(usize, usize, Vec), #[error(transparent)] - Wikitext(#[from] Box), + Wikitext(#[from] WikitextError), } impl ParserError { @@ -20,12 +20,6 @@ impl ParserError { } } -impl From for ParserError { - fn from(e: WikitextError) -> Self { - Self::Wikitext(Box::new(e)) - } -} - #[derive(Debug)] pub struct WikitextParser { tokens: Vec, diff --git a/src/site.rs b/src/site.rs index 8bdef2b..49da9f2 100644 --- a/src/site.rs +++ b/src/site.rs @@ -1,7 +1,7 @@ use crate::git::git_whatchanged; use crate::name::{Name, NameBuilder, Names}; use crate::page::{MarkdownPage, Page, UnprocessedPage, WikitextPage}; -use crate::parser::WikitextParser; +use crate::parser::{ParserError, WikitextParser}; use crate::srcdir::{PathFilter, SourceDir}; use crate::token::TokenPatterns; use crate::util::make_relative_link; @@ -22,12 +22,18 @@ pub enum SiteError { Git(#[from] crate::git::GitError), #[error(transparent)] - Parser(#[from] crate::parser::ParserError), + Parser(#[from] Box), #[error(transparent)] WalkDir(#[from] crate::srcdir::SourceDirError), } +impl From for SiteError { + fn from(e: ParserError) -> Self { + Self::Parser(Box::new(e)) + } +} + pub struct Site { patterns: TokenPatterns, shortcuts: HashMap, -- cgit v1.2.1