summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-04-08 15:46:24 +0200
committerMartin Fischer <martin@push-f.com>2021-04-08 15:57:18 +0200
commiteb0e8506472f2d672b00227bb07089c313484945 (patch)
tree01e7d8ee398940515952830a1177e497c561f937
parent18a022579737acc599277258fc4a8472ba73a8b0 (diff)
stop exporting macros
-rw-r--r--src/lib.rs1
-rw-r--r--src/macros.rs13
-rw-r--r--src/util/str.rs11
3 files changed, 11 insertions, 14 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 453c5de..40cbf8f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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);