summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2019-04-03 13:51:26 -0400
committerAndrew Gallant <jamslam@gmail.com>2019-04-03 13:51:26 -0400
commitcd9815cb376e4679af93a90a964cdb78173318da (patch)
tree985bee0d0c0255847fbbb9d353965a742181693a
parent3f22c3a658b594c40b3a9f9466e481a64c483dc1 (diff)
deps: update to aho-corasick 0.7
We do the simplest possible change to migrate to the new version. Fixes #1228
-rw-r--r--Cargo.lock11
-rw-r--r--globset/Cargo.toml2
-rw-r--r--globset/src/lib.rs32
3 files changed, 17 insertions, 28 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 5b76123e..fe865c51 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,14 +2,6 @@
# It is not intended for manual editing.
[[package]]
name = "aho-corasick"
-version = "0.6.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "aho-corasick"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -137,7 +129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "globset"
version = "0.4.2"
dependencies = [
- "aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -676,7 +668,6 @@ dependencies = [
]
[metadata]
-"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
diff --git a/globset/Cargo.toml b/globset/Cargo.toml
index 246fa127..81cb2c31 100644
--- a/globset/Cargo.toml
+++ b/globset/Cargo.toml
@@ -19,7 +19,7 @@ name = "globset"
bench = false
[dependencies]
-aho-corasick = "0.6.8"
+aho-corasick = "0.7.3"
fnv = "1.0.6"
log = "0.4.5"
memchr = "2.1.0"
diff --git a/globset/src/lib.rs b/globset/src/lib.rs
index 7196b8f2..a558e15b 100644
--- a/globset/src/lib.rs
+++ b/globset/src/lib.rs
@@ -119,7 +119,7 @@ use std::hash;
use std::path::Path;
use std::str;
-use aho_corasick::{Automaton, AcAutomaton, FullAcAutomaton};
+use aho_corasick::AhoCorasick;
use regex::bytes::{Regex, RegexBuilder, RegexSet};
use pathutil::{
@@ -648,7 +648,7 @@ impl ExtensionStrategy {
#[derive(Clone, Debug)]
struct PrefixStrategy {
- matcher: FullAcAutomaton<Vec<u8>>,
+ matcher: AhoCorasick,
map: Vec<usize>,
longest: usize,
}
@@ -656,8 +656,8 @@ struct PrefixStrategy {
impl PrefixStrategy {
fn is_match(&self, candidate: &Candidate) -> bool {
let path = candidate.path_prefix(self.longest);
- for m in self.matcher.find_overlapping(path) {
- if m.start == 0 {
+ for m in self.matcher.find_overlapping_iter(path) {
+ if m.start() == 0 {
return true;
}
}
@@ -666,9 +666,9 @@ impl PrefixStrategy {
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
let path = candidate.path_prefix(self.longest);
- for m in self.matcher.find_overlapping(path) {
- if m.start == 0 {
- matches.push(self.map[m.pati]);
+ for m in self.matcher.find_overlapping_iter(path) {
+ if m.start() == 0 {
+ matches.push(self.map[m.pattern()]);
}
}
}
@@ -676,7 +676,7 @@ impl PrefixStrategy {
#[derive(Clone, Debug)]
struct SuffixStrategy {
- matcher: FullAcAutomaton<Vec<u8>>,
+ matcher: AhoCorasick,
map: Vec<usize>,
longest: usize,
}
@@ -684,8 +684,8 @@ struct SuffixStrategy {
impl SuffixStrategy {
fn is_match(&self, candidate: &Candidate) -> bool {
let path = candidate.path_suffix(self.longest);
- for m in self.matcher.find_overlapping(path) {
- if m.end == path.len() {
+ for m in self.matcher.find_overlapping_iter(path) {
+ if m.end() == path.len() {
return true;
}
}
@@ -694,9 +694,9 @@ impl SuffixStrategy {
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
let path = candidate.path_suffix(self.longest);
- for m in self.matcher.find_overlapping(path) {
- if m.end == path.len() {
- matches.push(self.map[m.pati]);
+ for m in self.matcher.find_overlapping_iter(path) {
+ if m.end() == path.len() {
+ matches.push(self.map[m.pattern()]);
}
}
}
@@ -781,18 +781,16 @@ impl MultiStrategyBuilder {
}
fn prefix(self) -> PrefixStrategy {
- let it = self.literals.into_iter().map(|s| s.into_bytes());
PrefixStrategy {
- matcher: AcAutomaton::new(it).into_full(),
+ matcher: AhoCorasick::new_auto_configured(&self.literals),
map: self.map,
longest: self.longest,
}
}
fn suffix(self) -> SuffixStrategy {
- let it = self.literals.into_iter().map(|s| s.into_bytes());
SuffixStrategy {
- matcher: AcAutomaton::new(it).into_full(),
+ matcher: AhoCorasick::new_auto_configured(&self.literals),
map: self.map,
longest: self.longest,
}