Make the tracing macros optional.

This commit is contained in:
Tom Alexander
2023-08-10 20:04:59 -04:00
parent 1f10d3d064
commit cd1b4ba785
44 changed files with 250 additions and 228 deletions

View File

@@ -20,7 +20,7 @@ use crate::parser::util::get_consumed;
use crate::parser::util::get_one_before;
use crate::parser::Target;
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn target<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Target<'s>> {
let (remaining, _) = tag("<<")(input)?;
let (remaining, _) = peek(verify(anychar, |c| {
@@ -54,7 +54,7 @@ pub fn target<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str,
Ok((remaining, Target { source }))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn target_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
recognize(one_of("<>\n"))(input)
}