From 60c7a2bb191215d2d98e0f57ab1ca5c23f26fee9 Mon Sep 17 00:00:00 2001 From: Jonathan Cornaz Date: Sun, 5 Feb 2023 17:58:47 +0100 Subject: [PATCH] feat: stabilize include directive --- src/directive.rs | 16 ---------------- src/lib.rs | 2 -- 2 files changed, 18 deletions(-) diff --git a/src/directive.rs b/src/directive.rs index 4ca1484..7f64ef0 100644 --- a/src/directive.rs +++ b/src/directive.rs @@ -1,6 +1,5 @@ use crate::assertion::assertion; use crate::close::close; -#[cfg(feature = "unstable")] use crate::include::{include, Include}; use crate::open::open; use crate::price::{price, Price}; @@ -29,7 +28,6 @@ pub enum Directive<'a> { /// The [`Assertion`](crate::Assertion) (`balance`) account directive Assertion(Assertion<'a>), /// The [`Include`](crate::Include) directive - #[cfg(feature = "unstable")] Include(Include), } @@ -65,24 +63,11 @@ impl<'a> Directive<'a> { Directive::Close(c) => Some(c.date()), Directive::Price(p) => Some(p.date()), Directive::Assertion(a) => Some(a.date()), - #[cfg(feature = "unstable")] Directive::Include(_) => None, } } } -#[cfg(not(feature = "unstable"))] -pub(crate) fn directive(input: &str) -> IResult<&str, Directive<'_>> { - alt(( - map(transaction, Directive::Transaction), - map(price, Directive::Price), - map(open, Directive::Open), - map(close, Directive::Close), - map(assertion, Directive::Assertion), - ))(input) -} - -#[cfg(feature = "unstable")] pub(crate) fn directive(input: &str) -> IResult<&str, Directive<'_>> { alt(( map(transaction, Directive::Transaction), @@ -140,7 +125,6 @@ mod tests { } #[test] - #[cfg(feature = "unstable")] fn include_directive() { use nom::combinator::all_consuming; let (_, directive) = all_consuming(directive)(r#"include "myfile.beancount""#).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index e6a1215..fc0d7ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,7 +57,6 @@ mod close; mod date; mod directive; mod error; -#[cfg(feature = "unstable")] mod include; mod metadata; mod open; @@ -72,7 +71,6 @@ pub use crate::{ directive::Directive, error::Error, open::Open, price::Price, transaction::Transaction, }; -#[cfg(feature = "unstable")] pub use crate::include::Include; use nom::{