diff --git a/aho-corasick-debug/main.rs b/aho-corasick-debug/main.rs index 751cc01..5f5a3b9 100644 --- a/aho-corasick-debug/main.rs +++ b/aho-corasick-debug/main.rs @@ -122,6 +122,8 @@ impl Args { eprintln!("pattern read time: {:?}", read_time); let start = Instant::now(); + // TODO: remove when byte classes and premultiply options are removed. + #[allow(deprecated)] let ac = AhoCorasickBuilder::new() .match_kind(self.match_kind) .ascii_case_insensitive(self.ascii_casei) diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs index 846d07a..2b1aa5c 100644 --- a/src/ahocorasick.rs +++ b/src/ahocorasick.rs @@ -1005,18 +1005,6 @@ impl AhoCorasick { /// /// let ac = AhoCorasickBuilder::new() /// .dfa(true) - /// .byte_classes(false) - /// .build(&["foo", "bar", "baz"]); - /// assert_eq!(20_768, ac.heap_bytes()); - /// - /// let ac = AhoCorasickBuilder::new() - /// .dfa(true) - /// .byte_classes(true) // default - /// .build(&["foo", "bar", "baz"]); - /// assert_eq!(1_248, ac.heap_bytes()); - /// - /// let ac = AhoCorasickBuilder::new() - /// .dfa(true) /// .ascii_case_insensitive(true) /// .build(&["foo", "bar", "baz"]); /// assert_eq!(1_248, ac.heap_bytes()); @@ -1681,7 +1669,7 @@ impl AhoCorasickBuilder { // N.B. Using byte classes can actually be faster by improving // locality, but this only really applies for multi-megabyte // automata (i.e., automata that don't fit in your CPU's cache). - self.dfa(true).byte_classes(false); + self.dfa(true); } else if patterns.len() <= 5000 { self.dfa(true); } @@ -1928,6 +1916,10 @@ impl AhoCorasickBuilder { /// overall performance. /// /// This option is enabled by default. + #[deprecated( + since = "0.7.16", + note = "not carrying its weight, will be always enabled, see: https://github.com/BurntSushi/aho-corasick/issues/57" + )] pub fn byte_classes(&mut self, yes: bool) -> &mut AhoCorasickBuilder { self.dfa_builder.byte_classes(yes); self @@ -1956,6 +1948,10 @@ impl AhoCorasickBuilder { /// non-premultiplied form only requires 8 bits. /// /// This option is enabled by default. + #[deprecated( + since = "0.7.16", + note = "not carrying its weight, will be always enabled, see: https://github.com/BurntSushi/aho-corasick/issues/57" + )] pub fn premultiply(&mut self, yes: bool) -> &mut AhoCorasickBuilder { self.dfa_builder.premultiply(yes); self diff --git a/src/tests.rs b/src/tests.rs index 7b91f50..25c0d5f 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -739,6 +739,8 @@ macro_rules! testcombo { $collection, $kind, |b: &mut AhoCorasickBuilder| { + // TODO: remove tests when option is removed. + #[allow(deprecated)] b.dfa(true).byte_classes(false); } ); @@ -747,6 +749,8 @@ macro_rules! testcombo { $collection, $kind, |b: &mut AhoCorasickBuilder| { + // TODO: remove tests when option is removed. + #[allow(deprecated)] b.dfa(true).premultiply(false); } ); @@ -755,6 +759,8 @@ macro_rules! testcombo { $collection, $kind, |b: &mut AhoCorasickBuilder| { + // TODO: remove tests when options are removed. + #[allow(deprecated)] b.dfa(true).byte_classes(false).premultiply(false); } ); @@ -830,6 +836,8 @@ testconfig!( AC_STANDARD_OVERLAPPING, Standard, |b: &mut AhoCorasickBuilder| { + // TODO: remove tests when option is removed. + #[allow(deprecated)] b.dfa(true).byte_classes(false); } ); @@ -839,6 +847,8 @@ testconfig!( AC_STANDARD_OVERLAPPING, Standard, |b: &mut AhoCorasickBuilder| { + // TODO: remove tests when option is removed. + #[allow(deprecated)] b.dfa(true).premultiply(false); } ); @@ -848,6 +858,8 @@ testconfig!( AC_STANDARD_OVERLAPPING, Standard, |b: &mut AhoCorasickBuilder| { + // TODO: remove tests when options are removed. + #[allow(deprecated)] b.dfa(true).byte_classes(false).premultiply(false); } );