diff --git a/html5ever/Cargo.toml b/html5ever/Cargo.toml index 5a8e257e..4610ace1 100644 --- a/html5ever/Cargo.toml +++ b/html5ever/Cargo.toml @@ -11,6 +11,9 @@ build = "build.rs" categories = [ "parser-implementations", "web-programming" ] edition = "2021" +[features] +trace_tokenizer = [] + [dependencies] log = "0.4" mac = "0.1" diff --git a/html5ever/src/tokenizer/mod.rs b/html5ever/src/tokenizer/mod.rs index 1bf62af2..9e777dbc 100644 --- a/html5ever/src/tokenizer/mod.rs +++ b/html5ever/src/tokenizer/mod.rs @@ -616,13 +616,13 @@ macro_rules! shorthand ( // Tracing of tokenizer actions. This adds significant bloat and compile time, // so it's behind a cfg flag. -#[cfg(trace_tokenizer)] +#[cfg(feature = "trace_tokenizer")] macro_rules! sh_trace ( ( $me:ident : $($cmds:tt)* ) => ({ - trace!(" {:s}", stringify!($($cmds)*)); - shorthand!($me:expr : $($cmds)*); + trace!(" {:?}", stringify!($($cmds)*)); + shorthand!($me : $($cmds)*); })); -#[cfg(not(trace_tokenizer))] +#[cfg(not(feature = "trace_tokenizer"))] macro_rules! sh_trace ( ( $me:ident : $($cmds:tt)* ) => ( shorthand!($me: $($cmds)*) ) ); // A little DSL for sequencing shorthand actions. diff --git a/rcdom/tests/xml-tokenizer.rs b/rcdom/tests/xml-tokenizer.rs index ddb5d2ec..3370db87 100644 --- a/rcdom/tests/xml-tokenizer.rs +++ b/rcdom/tests/xml-tokenizer.rs @@ -140,6 +140,7 @@ fn tokenize_xml(input: Vec, opts: XmlTokenizerOpts) -> Vec { tok.sink.get_tokens() } +#[allow(dead_code)] trait JsonExt: Sized { fn get_str(&self) -> String; fn get_tendril(&self) -> StrTendril; diff --git a/xml5ever/Cargo.toml b/xml5ever/Cargo.toml index e0309654..41f7ca8c 100644 --- a/xml5ever/Cargo.toml +++ b/xml5ever/Cargo.toml @@ -13,6 +13,9 @@ exclude = ["xml5lib-tests/*"] categories = ["parser-implementations", "web-programming"] edition = "2021" +[features] +trace_tokenizer = [] + [dependencies] log = "0.4" mac = "0.1" diff --git a/xml5ever/src/tokenizer/mod.rs b/xml5ever/src/tokenizer/mod.rs index 4aad2207..e81430f2 100644 --- a/xml5ever/src/tokenizer/mod.rs +++ b/xml5ever/src/tokenizer/mod.rs @@ -546,13 +546,13 @@ macro_rules! shorthand ( // Tracing of tokenizer actions. This adds significant bloat and compile time, // so it's behind a cfg flag. -#[cfg(trace_tokenizer)] +#[cfg(feature = "trace_tokenizer")] macro_rules! sh_trace ( ( $me:ident : $($cmds:tt)* ) => ({ - debug!(" {:s}", stringify!($($cmds)*)); - shorthand!($me:expr : $($cmds)*); + debug!(" {:?}", stringify!($($cmds)*)); + shorthand!($me : $($cmds)*); })); -#[cfg(not(trace_tokenizer))] +#[cfg(not(feature = "trace_tokenizer"))] macro_rules! sh_trace ( ( $me:ident : $($cmds:tt)* ) => ( shorthand!($me: $($cmds)*) ) ); // A little DSL for sequencing shorthand actions.