Make the tracing macros optional.
This commit is contained in:
@@ -23,7 +23,7 @@ use crate::parser::util::get_consumed;
|
||||
use crate::parser::util::get_one_before;
|
||||
use crate::parser::util::WORD_CONSTITUENT_CHARACTERS;
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
pub fn plain_link<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, PlainLink<'s>> {
|
||||
let (remaining, _) = pre(context, input)?;
|
||||
let (remaining, proto) = protocol(context, remaining)?;
|
||||
@@ -41,7 +41,7 @@ pub fn plain_link<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s s
|
||||
))
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn pre<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, ()> {
|
||||
let document_root = context.get_document_root().unwrap();
|
||||
let preceding_character = get_one_before(document_root, input)
|
||||
@@ -61,13 +61,13 @@ fn pre<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, ()> {
|
||||
Ok((input, ()))
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn post<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, ()> {
|
||||
let (remaining, _) = alt((eof, recognize(none_of(WORD_CONSTITUENT_CHARACTERS))))(input)?;
|
||||
Ok((remaining, ()))
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
pub fn protocol<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
||||
// TODO: This should be defined by org-link-parameters
|
||||
let (remaining, proto) = alt((
|
||||
@@ -102,7 +102,7 @@ pub fn protocol<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str
|
||||
Ok((remaining, proto))
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn path_plain<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
||||
// TODO: "optionally containing parenthesis-wrapped non-whitespace non-bracket substrings up to a depth of two. The string must end with either a non-punctation non-whitespace character, a forwards slash, or a parenthesis-wrapped substring"
|
||||
let parser_context =
|
||||
@@ -117,7 +117,7 @@ fn path_plain<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str,
|
||||
Ok((remaining, path))
|
||||
}
|
||||
|
||||
#[tracing::instrument(ret, level = "debug")]
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn path_plain_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
||||
recognize(one_of(" \t\r\n()[]<>"))(input)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user