diff options
-rw-r--r-- | src/lib.rs | 1 | ||||
-rw-r--r-- | src/macros.rs | 13 | ||||
-rw-r--r-- | src/util/str.rs | 11 |
3 files changed, 11 insertions, 14 deletions
@@ -17,7 +17,6 @@ mod macros; /// Create a [`SmallCharSet`], with each space-separated number stored in the set. /// /// [`SmallCharSet`]: struct.SmallCharSet.html -#[macro_export] macro_rules! small_char_set ( ($($e:expr)+) => ( $ crate ::util::smallcharset::SmallCharSet { bits: $( (1 << ($e as usize)) )|+ diff --git a/src/macros.rs b/src/macros.rs index 55977a4..643e754 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -42,7 +42,6 @@ macro_rules! time { /// When `$enabled` is false, this avoids the overhead of allocating /// and writing to a buffer, as well as any overhead or side effects /// of the format arguments. -#[macro_export] macro_rules! format_if { ($enabled:expr, $borrowed:expr, $fmt:expr, $($args:expr),*) => { if $enabled { @@ -51,16 +50,4 @@ macro_rules! format_if { ::std::borrow::Cow::Borrowed($borrowed) } } -} - -/// Generate a test function `$name` which asserts that `$left` and `$right` -/// are equal. -#[macro_export] -macro_rules! test_eq { - ($name:ident, $left:expr, $right:expr) => { - #[test] - fn $name() { - assert_eq!($left, $right); - } - } }
\ No newline at end of file diff --git a/src/util/str.rs b/src/util/str.rs index 84604bc..c3185a0 100644 --- a/src/util/str.rs +++ b/src/util/str.rs @@ -27,6 +27,17 @@ pub fn is_ascii_alnum(c: char) -> bool { mod test { use super::{is_ascii_alnum, lower_ascii_letter}; + /// Generate a test function `$name` which asserts that `$left` and `$right` + /// are equal. + macro_rules! test_eq { + ($name:ident, $left:expr, $right:expr) => { + #[test] + fn $name() { + assert_eq!($left, $right); + } + } + } + test_eq!(lower_letter_a_is_a, lower_ascii_letter('a'), Some('a')); test_eq!(lower_letter_A_is_a, lower_ascii_letter('A'), Some('a')); test_eq!(lower_letter_symbol_is_None, lower_ascii_letter('!'), None); |