From 5a00534bd4c0a44d063c592a471b8b546f1b5925 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 25 Feb 2023 14:34:32 +0100 Subject: refactor: remove ParagraphPart 'inner' method --- src/description.rs | 5 ----- src/lib.rs | 1 - src/util.rs | 34 ---------------------------------- 3 files changed, 40 deletions(-) delete mode 100644 src/util.rs diff --git a/src/description.rs b/src/description.rs index d57dbc7..adc5324 100644 --- a/src/description.rs +++ b/src/description.rs @@ -1,5 +1,4 @@ //! Reference entry description. -use crate::util::enum_with_get_inner; use crate::xml::element::{Elements, FromElements, Tagged}; /// Reference entry description. @@ -106,9 +105,6 @@ pub enum ParagraphError InvalidPart(#[from] ParagraphPartError), } -enum_with_get_inner! { -inner = String; - /// Reference entry description paragraph part. #[derive(Debug)] pub enum ParagraphPart @@ -128,7 +124,6 @@ pub enum ParagraphPart /// Reference entry citation part. Entry(String), } -} impl FromElements for ParagraphPart { diff --git a/src/lib.rs b/src/lib.rs index f4d465f..11d376c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,7 +15,6 @@ use crate::xml::parser::{Error as ParserError, Parser}; pub mod description; -mod util; mod xml; static GL4_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/OpenGL-Refpages/gl4"); diff --git a/src/util.rs b/src/util.rs deleted file mode 100644 index 309a471..0000000 --- a/src/util.rs +++ /dev/null @@ -1,34 +0,0 @@ -macro_rules! enum_with_get_inner { - ( - inner = $inner: ty; - $(#[$attr: meta])* - $visibility: vis enum $enum_name: ident { - $( - $(#[$variant_attr: meta])* - $variant: ident($variant_inner: ty), - )* - } - ) => { - $(#[$attr])* - $visibility enum $enum_name { - $( - $(#[$variant_attr])* - $variant($inner) - ),* - } - - impl $enum_name { - /// Returns the inner value. - #[must_use] - pub fn inner(&self) -> &$inner { - match self { - $( - $enum_name::$variant(inner) => inner - ),* - } - } - } - }; -} - -pub(crate) use enum_with_get_inner; -- cgit v1.2.3-18-g5258