diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-01-07 13:19:11 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-01-07 13:19:11 +0200 |
commit | 45916f032a7fbbd30f8d3dac2870a837d2c4684f (patch) | |
tree | 11a9231dd2aef733a1baaa9863445cda161310ff | |
parent | 50ff83b1ae0bd49555f4c26cdc221d0a712a6f7d (diff) | |
download | riki-45916f032a7fbbd30f8d3dac2870a837d2c4684f.tar.gz |
refactor: box value in ParserError::Wikitext
Sponsored-by: author
-rw-r--r-- | src/parser.rs | 8 | ||||
-rw-r--r-- | 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<crate::token::TokenKind>), #[error(transparent)] - Wikitext(#[from] Box<WikitextError>), + Wikitext(#[from] WikitextError), } impl ParserError { @@ -20,12 +20,6 @@ impl ParserError { } } -impl From<WikitextError> for ParserError { - fn from(e: WikitextError) -> Self { - Self::Wikitext(Box::new(e)) - } -} - #[derive(Debug)] pub struct WikitextParser { tokens: Vec<TokenKind>, 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<ParserError>), #[error(transparent)] WalkDir(#[from] crate::srcdir::SourceDirError), } +impl From<ParserError> for SiteError { + fn from(e: ParserError) -> Self { + Self::Parser(Box::new(e)) + } +} + pub struct Site { patterns: TokenPatterns, shortcuts: HashMap<String, Shortcut>, |