aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--Android.bp37
-rw-r--r--Cargo.toml11
-rw-r--r--Cargo.toml.orig18
-rw-r--r--METADATA10
-rw-r--r--README.md8
-rw-r--r--TEST_MAPPING50
-rw-r--r--cargo2android.json11
-rw-r--r--src/ahocorasick.rs48
-rw-r--r--src/automaton.rs8
-rw-r--r--src/classes.rs4
-rw-r--r--src/dfa.rs16
-rw-r--r--src/error.rs2
-rw-r--r--src/lib.rs7
-rw-r--r--src/nfa.rs20
-rw-r--r--src/packed/api.rs8
-rw-r--r--src/packed/mod.rs2
-rw-r--r--src/packed/pattern.rs10
-rw-r--r--src/packed/rabinkarp.rs4
-rw-r--r--src/packed/teddy/compile.rs10
-rw-r--r--src/packed/teddy/mod.rs12
-rw-r--r--src/packed/teddy/runtime.rs8
-rw-r--r--src/packed/tests.rs4
-rw-r--r--src/prefilter.rs12
-rw-r--r--src/state_id.rs2
-rw-r--r--src/tests.rs18
27 files changed, 132 insertions, 212 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index f618c96..ae0871a 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "1b116376d6a8f920adf5add27a689b2134eec8d0"
+ "sha1": "3852632f10587db0ff72ef29e88d58bf305a0946"
}
}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 82f1216..34ef326 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,7 +31,7 @@ jobs:
include:
- build: pinned
os: ubuntu-18.04
- rust: 1.41.1
+ rust: 1.28.0
- build: stable
os: ubuntu-18.04
rust: stable
diff --git a/Android.bp b/Android.bp
index ed19984..1ae2992 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,4 @@
-// This file is generated by cargo2android.py --config cargo2android.json.
-// Do not modify this file as changes will be overridden on upgrade.
+// This file is generated by cargo2android.py --run --dependencies --device.
package {
default_applicable_licenses: ["external_rust_crates_aho-corasick_license"],
@@ -38,36 +37,12 @@ license {
],
}
-rust_test {
- name: "aho-corasick_test_src_lib",
- host_supported: true,
- crate_name: "aho_corasick",
- cargo_env_compat: true,
- cargo_pkg_version: "0.7.18",
- srcs: ["src/lib.rs"],
- test_suites: ["general-tests"],
- auto_gen_config: true,
- test_options: {
- unit_test: true,
- },
- edition: "2018",
- features: [
- "default",
- "std",
- ],
- rustlibs: [
- "libmemchr",
- ],
-}
-
rust_library {
name: "libaho_corasick",
host_supported: true,
crate_name: "aho_corasick",
- cargo_env_compat: true,
- cargo_pkg_version: "0.7.18",
srcs: ["src/lib.rs"],
- edition: "2018",
+ edition: "2015",
features: [
"default",
"std",
@@ -75,9 +50,7 @@ rust_library {
rustlibs: [
"libmemchr",
],
- apex_available: [
- "//apex_available:platform",
- "com.android.compos",
- "com.android.virt",
- ],
}
+
+// dependent_library ["feature_list"]
+// memchr-2.3.4 "std,use_std"
diff --git a/Cargo.toml b/Cargo.toml
index 62b5f7e..38d89ae 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,9 +11,8 @@
# will likely look very different (and much more reasonable)
[package]
-edition = "2018"
name = "aho-corasick"
-version = "0.7.18"
+version = "0.7.15"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
exclude = ["/aho-corasick-debug", "/ci/*", "/.travis.yml", "/appveyor.yml"]
autotests = false
@@ -33,11 +32,11 @@ debug = true
[lib]
name = "aho_corasick"
[dependencies.memchr]
-version = "2.4.0"
+version = "2.2.0"
default-features = false
-
-[dev-dependencies]
+[dev-dependencies.doc-comment]
+version = "0.3.1"
[features]
default = ["std"]
-std = ["memchr/std"]
+std = ["memchr/use_std"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 06a91f1..37a6852 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "aho-corasick"
-version = "0.7.18" #:version
+version = "0.7.15" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Fast multiple substring searching."
homepage = "https://github.com/BurntSushi/aho-corasick"
@@ -13,25 +13,31 @@ autotests = false
exclude = [
"/aho-corasick-debug", "/ci/*", "/.travis.yml", "/appveyor.yml",
]
-edition = "2018"
[workspace]
-members = ["aho-corasick-debug", "bench"]
+members = ["bench"]
+# We'd ideally not do this, but since the debug tool uses Rust 2018, older
+# versions of Rust (such as 1.28) fail to parse the manifest because it treats
+# `edition = "2018"` as an unstable feature.
+#
+# When we move our MSRV to Rust 2018, then we should be able to add this back
+# to the workspace.
+exclude = ["aho-corasick-debug"]
[lib]
name = "aho_corasick"
[features]
default = ["std"]
-std = ["memchr/std"]
+std = ["memchr/use_std"]
[dependencies]
-memchr = { version = "2.4.0", default-features = false }
+memchr = { version = "2.2.0", default-features = false }
[dev-dependencies]
# TODO: Re-enable this once the MSRV is 1.43 or greater.
# See: https://github.com/BurntSushi/aho-corasick/issues/62
-# doc-comment = "0.3.1"
+doc-comment = "0.3.1"
[profile.release]
debug = true
diff --git a/METADATA b/METADATA
index 3c735ca..a4ae357 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/aho-corasick/aho-corasick-0.7.18.crate"
+ value: "https://static.crates.io/crates/aho-corasick/aho-corasick-0.7.15.crate"
}
- version: "0.7.18"
+ version: "0.7.15"
license_type: NOTICE
last_upgrade_date {
- year: 2021
- month: 5
- day: 19
+ year: 2020
+ month: 11
+ day: 4
}
}
diff --git a/README.md b/README.md
index cd43051..2f7a18e 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,12 @@ Add this to your `Cargo.toml`:
aho-corasick = "0.7"
```
+and this to your crate root (if you're using Rust 2015):
+
+```rust
+extern crate aho_corasick;
+```
+
### Example: basic searching
@@ -156,7 +162,7 @@ expression alternation. See `MatchKind` in the docs for more details.
### Minimum Rust version policy
-This crate's minimum supported `rustc` version is `1.41.1`.
+This crate's minimum supported `rustc` version is `1.28.0`.
The current policy is that the minimum Rust version required to use this crate
can be increased in minor version updates. For example, if `crate 1.0` requires
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 6a2d8bc..6716814 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,54 +1,8 @@
-// Generated by update_crate_tests.py for tests that depend on this crate.
+// Generated by cargo2android.py for tests in Android.bp
{
- "imports": [
- {
- "path": "external/rust/crates/base64"
- },
- {
- "path": "external/rust/crates/libsqlite3-sys"
- },
- {
- "path": "external/rust/crates/once_cell"
- },
- {
- "path": "external/rust/crates/regex"
- },
- {
- "path": "external/rust/crates/tinytemplate"
- },
- {
- "path": "external/rust/crates/tinyvec"
- },
- {
- "path": "external/rust/crates/unicode-xid"
- }
- ],
"presubmit": [
{
- "name": "aho-corasick_test_src_lib"
- },
- {
- "name": "keystore2_test"
- },
- {
- "name": "legacykeystore_test"
- },
- {
- "name": "virtualizationservice_device_test"
- }
- ],
- "presubmit-rust": [
- {
- "name": "aho-corasick_test_src_lib"
- },
- {
- "name": "keystore2_test"
- },
- {
- "name": "legacykeystore_test"
- },
- {
- "name": "virtualizationservice_device_test"
+ "name": "libsqlite3-sys_device_test_src_lib"
}
]
}
diff --git a/cargo2android.json b/cargo2android.json
deleted file mode 100644
index 0e54308..0000000
--- a/cargo2android.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "apex-available": [
- "//apex_available:platform",
- "com.android.compos",
- "com.android.virt"
- ],
- "dependencies": true,
- "device": true,
- "run": true,
- "tests": true
-}
diff --git a/src/ahocorasick.rs b/src/ahocorasick.rs
index 2b1aa5c..9069396 100644
--- a/src/ahocorasick.rs
+++ b/src/ahocorasick.rs
@@ -1,14 +1,14 @@
use std::io;
-use crate::automaton::Automaton;
-use crate::buffer::Buffer;
-use crate::dfa::{self, DFA};
-use crate::error::Result;
-use crate::nfa::{self, NFA};
-use crate::packed;
-use crate::prefilter::{Prefilter, PrefilterState};
-use crate::state_id::StateID;
-use crate::Match;
+use automaton::Automaton;
+use buffer::Buffer;
+use dfa::{self, DFA};
+use error::Result;
+use nfa::{self, NFA};
+use packed;
+use prefilter::{Prefilter, PrefilterState};
+use state_id::StateID;
+use Match;
/// An automaton for searching multiple strings in linear time.
///
@@ -1005,6 +1005,18 @@ impl<S: StateID> AhoCorasick<S> {
///
/// 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());
@@ -1157,7 +1169,7 @@ impl<S: StateID> Imp<S> {
///
/// The lifetime `'b` refers to the lifetime of the haystack being searched.
#[derive(Debug)]
-pub struct FindIter<'a, 'b, S: StateID> {
+pub struct FindIter<'a, 'b, S: 'a + StateID> {
fsm: &'a Imp<S>,
prestate: PrefilterState,
haystack: &'b [u8],
@@ -1214,7 +1226,7 @@ impl<'a, 'b, S: StateID> Iterator for FindIter<'a, 'b, S> {
///
/// The lifetime `'b` refers to the lifetime of the haystack being searched.
#[derive(Debug)]
-pub struct FindOverlappingIter<'a, 'b, S: StateID> {
+pub struct FindOverlappingIter<'a, 'b, S: 'a + StateID> {
fsm: &'a Imp<S>,
prestate: PrefilterState,
haystack: &'b [u8],
@@ -1285,7 +1297,7 @@ impl<'a, 'b, S: StateID> Iterator for FindOverlappingIter<'a, 'b, S> {
///
/// The lifetime `'a` refers to the lifetime of the `AhoCorasick` automaton.
#[derive(Debug)]
-pub struct StreamFindIter<'a, R, S: StateID> {
+pub struct StreamFindIter<'a, R, S: 'a + StateID> {
it: StreamChunkIter<'a, R, S>,
}
@@ -1320,7 +1332,7 @@ impl<'a, R: io::Read, S: StateID> Iterator for StreamFindIter<'a, R, S> {
/// N.B. This does not actually implement Iterator because we need to borrow
/// from the underlying reader. But conceptually, it's still an iterator.
#[derive(Debug)]
-struct StreamChunkIter<'a, R, S: StateID> {
+struct StreamChunkIter<'a, R, S: 'a + StateID> {
/// The AC automaton.
fsm: &'a Imp<S>,
/// State associated with this automaton's prefilter. It is a heuristic
@@ -1669,7 +1681,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);
+ self.dfa(true).byte_classes(false);
} else if patterns.len() <= 5000 {
self.dfa(true);
}
@@ -1916,10 +1928,6 @@ 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
@@ -1948,10 +1956,6 @@ 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/automaton.rs b/src/automaton.rs
index b971bf3..2ada1a0 100644
--- a/src/automaton.rs
+++ b/src/automaton.rs
@@ -1,7 +1,7 @@
-use crate::ahocorasick::MatchKind;
-use crate::prefilter::{self, Candidate, Prefilter, PrefilterState};
-use crate::state_id::{dead_id, fail_id, StateID};
-use crate::Match;
+use ahocorasick::MatchKind;
+use prefilter::{self, Candidate, Prefilter, PrefilterState};
+use state_id::{dead_id, fail_id, StateID};
+use Match;
// NOTE: This trait essentially started as a copy of the same trait from from
// regex-automata, with some wording changed since we use this trait for
diff --git a/src/classes.rs b/src/classes.rs
index f84ae21..1fba7ea 100644
--- a/src/classes.rs
+++ b/src/classes.rs
@@ -64,7 +64,7 @@ impl ByteClasses {
/// hasn't been converted to equivalence classes yet. Picking an arbitrary
/// byte from each equivalence class then permits a full exploration of
/// the NFA instead of using every possible byte value.
- pub fn representatives(&self) -> ByteClassRepresentatives<'_> {
+ pub fn representatives(&self) -> ByteClassRepresentatives {
ByteClassRepresentatives { classes: self, byte: 0, last_class: None }
}
@@ -85,7 +85,7 @@ impl ByteClasses {
}
impl fmt::Debug for ByteClasses {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.is_singleton() {
write!(f, "ByteClasses({{singletons}})")
} else {
diff --git a/src/dfa.rs b/src/dfa.rs
index a03a254..8a4e727 100644
--- a/src/dfa.rs
+++ b/src/dfa.rs
@@ -1,13 +1,13 @@
use std::mem::size_of;
-use crate::ahocorasick::MatchKind;
-use crate::automaton::Automaton;
-use crate::classes::ByteClasses;
-use crate::error::Result;
-use crate::nfa::{PatternID, PatternLength, NFA};
-use crate::prefilter::{Prefilter, PrefilterObj, PrefilterState};
-use crate::state_id::{dead_id, fail_id, premultiply_overflow_error, StateID};
-use crate::Match;
+use ahocorasick::MatchKind;
+use automaton::Automaton;
+use classes::ByteClasses;
+use error::Result;
+use nfa::{PatternID, PatternLength, NFA};
+use prefilter::{Prefilter, PrefilterObj, PrefilterState};
+use state_id::{dead_id, fail_id, premultiply_overflow_error, StateID};
+use Match;
#[derive(Clone, Debug)]
pub enum DFA<S> {
diff --git a/src/error.rs b/src/error.rs
index a57a777..7dace63 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -68,7 +68,7 @@ impl error::Error for Error {
}
impl fmt::Display for Error {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.kind {
ErrorKind::StateIDOverflow { max } => write!(
f,
diff --git a/src/lib.rs b/src/lib.rs
index 9a3d084..aa91c21 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -186,6 +186,7 @@ disabled via
#[cfg(not(feature = "std"))]
compile_error!("`std` feature is currently required to build this crate");
+extern crate memchr;
// #[cfg(doctest)]
// #[macro_use]
// extern crate doc_comment;
@@ -193,12 +194,12 @@ compile_error!("`std` feature is currently required to build this crate");
// #[cfg(doctest)]
// doctest!("../README.md");
-pub use crate::ahocorasick::{
+pub use ahocorasick::{
AhoCorasick, AhoCorasickBuilder, FindIter, FindOverlappingIter, MatchKind,
StreamFindIter,
};
-pub use crate::error::{Error, ErrorKind};
-pub use crate::state_id::StateID;
+pub use error::{Error, ErrorKind};
+pub use state_id::StateID;
mod ahocorasick;
mod automaton;
diff --git a/src/nfa.rs b/src/nfa.rs
index e29bb27..217be50 100644
--- a/src/nfa.rs
+++ b/src/nfa.rs
@@ -4,13 +4,13 @@ use std::fmt;
use std::mem::size_of;
use std::ops::{Index, IndexMut};
-use crate::ahocorasick::MatchKind;
-use crate::automaton::Automaton;
-use crate::classes::{ByteClassBuilder, ByteClasses};
-use crate::error::Result;
-use crate::prefilter::{self, opposite_ascii_case, Prefilter, PrefilterObj};
-use crate::state_id::{dead_id, fail_id, usize_to_state_id, StateID};
-use crate::Match;
+use ahocorasick::MatchKind;
+use automaton::Automaton;
+use classes::{ByteClassBuilder, ByteClasses};
+use error::Result;
+use prefilter::{self, opposite_ascii_case, Prefilter, PrefilterObj};
+use state_id::{dead_id, fail_id, usize_to_state_id, StateID};
+use Match;
/// The identifier for a pattern, which is simply the position of the pattern
/// in the sequence of patterns given by the caller.
@@ -172,7 +172,7 @@ impl<S: StateID> NFA<S> {
self.state_mut(id)
}
- fn iter_transitions_mut(&mut self, id: S) -> IterTransitionsMut<'_, S> {
+ fn iter_transitions_mut(&mut self, id: S) -> IterTransitionsMut<S> {
IterTransitionsMut::new(self, id)
}
@@ -497,7 +497,7 @@ impl<S: StateID> Transitions<S> {
/// is iterating over transitions, the caller can still mutate the NFA. This
/// is useful when creating failure transitions.
#[derive(Debug)]
-struct IterTransitionsMut<'a, S: StateID> {
+struct IterTransitionsMut<'a, S: StateID + 'a> {
nfa: &'a mut NFA<S>,
state_id: S,
cur: usize,
@@ -1274,7 +1274,7 @@ impl Iterator for AllBytesIter {
}
impl<S: StateID> fmt::Debug for NFA<S> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(f, "NFA(")?;
writeln!(f, "match_kind: {:?}", self.match_kind)?;
writeln!(f, "prefilter: {:?}", self.prefilter)?;
diff --git a/src/packed/api.rs b/src/packed/api.rs
index c15ae3f..3a316b5 100644
--- a/src/packed/api.rs
+++ b/src/packed/api.rs
@@ -1,9 +1,9 @@
use std::u16;
-use crate::packed::pattern::Patterns;
-use crate::packed::rabinkarp::RabinKarp;
-use crate::packed::teddy::{self, Teddy};
-use crate::Match;
+use packed::pattern::Patterns;
+use packed::rabinkarp::RabinKarp;
+use packed::teddy::{self, Teddy};
+use Match;
/// This is a limit placed on the total number of patterns we're willing to try
/// and match at once. As more sophisticated algorithms are added, this number
diff --git a/src/packed/mod.rs b/src/packed/mod.rs
index 25a7966..5a3aa2e 100644
--- a/src/packed/mod.rs
+++ b/src/packed/mod.rs
@@ -105,7 +105,7 @@ common reasons:
no searcher is built.
*/
-pub use crate::packed::api::{Builder, Config, FindIter, MatchKind, Searcher};
+pub use packed::api::{Builder, Config, FindIter, MatchKind, Searcher};
mod api;
mod pattern;
diff --git a/src/packed/pattern.rs b/src/packed/pattern.rs
index f4c6756..dfb07e9 100644
--- a/src/packed/pattern.rs
+++ b/src/packed/pattern.rs
@@ -4,7 +4,7 @@ use std::mem;
use std::u16;
use std::usize;
-use crate::packed::api::MatchKind;
+use packed::api::MatchKind;
/// The type used for representing a pattern identifier.
///
@@ -155,7 +155,7 @@ impl Patterns {
/// Return the pattern with the given identifier. If such a pattern does
/// not exist, then this panics.
- pub fn get(&self, id: PatternID) -> Pattern<'_> {
+ pub fn get(&self, id: PatternID) -> Pattern {
Pattern(&self.by_id[id as usize])
}
@@ -167,7 +167,7 @@ impl Patterns {
/// Callers must ensure that a pattern with the given identifier exists
/// before using this method.
#[cfg(target_arch = "x86_64")]
- pub unsafe fn get_unchecked(&self, id: PatternID) -> Pattern<'_> {
+ pub unsafe fn get_unchecked(&self, id: PatternID) -> Pattern {
Pattern(self.by_id.get_unchecked(id as usize))
}
@@ -189,7 +189,7 @@ impl Patterns {
/// the order provided by this iterator, then the result is guaranteed
/// to satisfy the correct match semantics. (Either leftmost-first or
/// leftmost-longest.)
- pub fn iter(&self) -> PatternIter<'_> {
+ pub fn iter(&self) -> PatternIter {
PatternIter { patterns: self, i: 0 }
}
}
@@ -226,7 +226,7 @@ impl<'p> Iterator for PatternIter<'p> {
pub struct Pattern<'a>(&'a [u8]);
impl<'a> fmt::Debug for Pattern<'a> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Pattern")
.field("lit", &String::from_utf8_lossy(&self.0))
.finish()
diff --git a/src/packed/rabinkarp.rs b/src/packed/rabinkarp.rs
index fa6b1e3..3992296 100644
--- a/src/packed/rabinkarp.rs
+++ b/src/packed/rabinkarp.rs
@@ -1,7 +1,7 @@
use std::mem;
-use crate::packed::pattern::{PatternID, Patterns};
-use crate::Match;
+use packed::pattern::{PatternID, Patterns};
+use Match;
/// The type of the rolling hash used in the Rabin-Karp algorithm.
type Hash = usize;
diff --git a/src/packed/teddy/compile.rs b/src/packed/teddy/compile.rs
index 741cb69..a7a48b7 100644
--- a/src/packed/teddy/compile.rs
+++ b/src/packed/teddy/compile.rs
@@ -4,8 +4,8 @@ use std::cmp;
use std::collections::BTreeMap;
use std::fmt;
-use crate::packed::pattern::{PatternID, Patterns};
-use crate::packed::teddy::Teddy;
+use packed::pattern::{PatternID, Patterns};
+use packed::teddy::Teddy;
/// A builder for constructing a Teddy matcher.
///
@@ -73,7 +73,7 @@ impl Builder {
}
fn build_imp(&self, patterns: &Patterns) -> Option<Teddy> {
- use crate::packed::teddy::runtime;
+ use packed::teddy::runtime;
// Most of the logic here is just about selecting the optimal settings,
// or perhaps even rejecting construction altogether. The choices
@@ -296,7 +296,7 @@ impl<'p> Compiler<'p> {
}
impl<'p> fmt::Debug for Compiler<'p> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut buckets = vec![vec![]; self.buckets.len()];
for (i, bucket) in self.buckets.iter().enumerate() {
for &patid in bucket {
@@ -400,7 +400,7 @@ impl Mask {
}
impl fmt::Debug for Mask {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let (mut parts_lo, mut parts_hi) = (vec![], vec![]);
for i in 0..32 {
parts_lo.push(format!("{:02}: {:08b}", i, self.lo[i]));
diff --git a/src/packed/teddy/mod.rs b/src/packed/teddy/mod.rs
index 3268cdf..b896023 100644
--- a/src/packed/teddy/mod.rs
+++ b/src/packed/teddy/mod.rs
@@ -1,11 +1,11 @@
#[cfg(target_arch = "x86_64")]
-pub use crate::packed::teddy::compile::Builder;
+pub use packed::teddy::compile::Builder;
#[cfg(not(target_arch = "x86_64"))]
-pub use crate::packed::teddy::fallback::Builder;
+pub use packed::teddy::fallback::Builder;
#[cfg(not(target_arch = "x86_64"))]
-pub use crate::packed::teddy::fallback::Teddy;
+pub use packed::teddy::fallback::Teddy;
#[cfg(target_arch = "x86_64")]
-pub use crate::packed::teddy::runtime::Teddy;
+pub use packed::teddy::runtime::Teddy;
#[cfg(target_arch = "x86_64")]
mod compile;
@@ -14,8 +14,8 @@ mod runtime;
#[cfg(not(target_arch = "x86_64"))]
mod fallback {
- use crate::packed::pattern::Patterns;
- use crate::Match;
+ use packed::pattern::Patterns;
+ use Match;
#[derive(Clone, Debug, Default)]
pub struct Builder(());
diff --git a/src/packed/teddy/runtime.rs b/src/packed/teddy/runtime.rs
index 0d96913..a736948 100644
--- a/src/packed/teddy/runtime.rs
+++ b/src/packed/teddy/runtime.rs
@@ -51,10 +51,10 @@
use std::arch::x86_64::*;
use std::mem;
-use crate::packed::pattern::{PatternID, Patterns};
-use crate::packed::teddy::compile;
-use crate::packed::vector::*;
-use crate::Match;
+use packed::pattern::{PatternID, Patterns};
+use packed::teddy::compile;
+use packed::vector::*;
+use Match;
/// The Teddy runtime.
///
diff --git a/src/packed/tests.rs b/src/packed/tests.rs
index 91410cb..a384396 100644
--- a/src/packed/tests.rs
+++ b/src/packed/tests.rs
@@ -1,8 +1,8 @@
use std::collections::HashMap;
use std::usize;
-use crate::packed::{Config, MatchKind};
-use crate::Match;
+use packed::{Config, MatchKind};
+use Match;
/// A description of a single test against a multi-pattern searcher.
///
diff --git a/src/prefilter.rs b/src/prefilter.rs
index ef81411..05fa46d 100644
--- a/src/prefilter.rs
+++ b/src/prefilter.rs
@@ -5,9 +5,9 @@ use std::u8;
use memchr::{memchr, memchr2, memchr3};
-use crate::ahocorasick::MatchKind;
-use crate::packed;
-use crate::Match;
+use ahocorasick::MatchKind;
+use packed;
+use Match;
/// A candidate is the result of running a prefilter on a haystack at a
/// particular position. The result is either no match, a confirmed match or
@@ -435,7 +435,7 @@ impl ByteSet {
}
impl fmt::Debug for ByteSet {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut bytes = vec![];
for b in 0..=255 {
if self.contains(b) {
@@ -471,7 +471,7 @@ impl RareByteOffsets {
}
impl fmt::Debug for RareByteOffsets {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut offsets = vec![];
for off in self.set.iter() {
if off.max > 0 {
@@ -1032,7 +1032,7 @@ pub fn opposite_ascii_case(b: u8) -> u8 {
/// Return the frequency rank of the given byte. The higher the rank, the more
/// common the byte (heuristically speaking).
fn freq_rank(b: u8) -> u8 {
- use crate::byte_frequencies::BYTE_FREQUENCIES;
+ use byte_frequencies::BYTE_FREQUENCIES;
BYTE_FREQUENCIES[b as usize]
}
diff --git a/src/state_id.rs b/src/state_id.rs
index 8973806..22f6be2 100644
--- a/src/state_id.rs
+++ b/src/state_id.rs
@@ -1,7 +1,7 @@
use std::fmt::Debug;
use std::hash::Hash;
-use crate::error::{Error, Result};
+use error::{Error, Result};
// NOTE: Most of this code was copied from regex-automata, but without the
// (de)serialization specific stuff.
diff --git a/src/tests.rs b/src/tests.rs
index 25c0d5f..668fbbf 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::io;
use std::usize;
-use crate::{AhoCorasickBuilder, Match, MatchKind};
+use {AhoCorasickBuilder, Match, MatchKind};
/// A description of a single test against an Aho-Corasick automaton.
///
@@ -739,8 +739,6 @@ macro_rules! testcombo {
$collection,
$kind,
|b: &mut AhoCorasickBuilder| {
- // TODO: remove tests when option is removed.
- #[allow(deprecated)]
b.dfa(true).byte_classes(false);
}
);
@@ -749,8 +747,6 @@ macro_rules! testcombo {
$collection,
$kind,
|b: &mut AhoCorasickBuilder| {
- // TODO: remove tests when option is removed.
- #[allow(deprecated)]
b.dfa(true).premultiply(false);
}
);
@@ -759,8 +755,6 @@ 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);
}
);
@@ -836,8 +830,6 @@ testconfig!(
AC_STANDARD_OVERLAPPING,
Standard,
|b: &mut AhoCorasickBuilder| {
- // TODO: remove tests when option is removed.
- #[allow(deprecated)]
b.dfa(true).byte_classes(false);
}
);
@@ -847,8 +839,6 @@ testconfig!(
AC_STANDARD_OVERLAPPING,
Standard,
|b: &mut AhoCorasickBuilder| {
- // TODO: remove tests when option is removed.
- #[allow(deprecated)]
b.dfa(true).premultiply(false);
}
);
@@ -858,8 +848,6 @@ 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);
}
);
@@ -1141,7 +1129,7 @@ fn regression_ascii_case_insensitive_no_exponential() {
// was incorrect, leading to a false negative.
#[test]
fn regression_rare_byte_prefilter() {
- use crate::AhoCorasick;
+ use AhoCorasick;
let ac = AhoCorasick::new_auto_configured(&["ab/j/", "x/"]);
assert!(ac.is_match("ab/j/"));
@@ -1149,7 +1137,7 @@ fn regression_rare_byte_prefilter() {
#[test]
fn regression_case_insensitive_prefilter() {
- use crate::AhoCorasickBuilder;
+ use AhoCorasickBuilder;
for c in b'a'..b'z' {
for c2 in b'a'..b'z' {