diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-09-15 22:06:04 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-09-15 22:06:04 -0400 |
commit | 0e46171e3b189b2bd89f45c3a492dea36361d8bc (patch) | |
tree | 3ae494e5fcf54c3a679ae42991050c78c7552dce /src/main.rs | |
parent | f5c85827cea05d11e1c0c50aa34e07361313f659 (diff) |
Rework glob sets.
We try to reduce the pressure on regexes and offload some of it to
Aho-Corasick or exact lookups.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index aa51ec79..936e4965 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ extern crate deque; extern crate docopt; extern crate env_logger; +extern crate fnv; extern crate grep; #[cfg(windows)] extern crate kernel32; @@ -36,6 +37,7 @@ use walkdir::DirEntry; use args::Args; use out::{ColoredTerminal, Out}; +use pathutil::strip_prefix; use printer::Printer; use search_stream::InputBuffer; #[cfg(windows)] @@ -60,6 +62,7 @@ mod gitignore; mod glob; mod ignore; mod out; +mod pathutil; mod printer; mod search_buffer; mod search_stream; @@ -257,7 +260,7 @@ impl Worker { } WorkReady::DirFile(ent, file) => { let mut path = ent.path(); - if let Ok(p) = path.strip_prefix("./") { + if let Some(p) = strip_prefix("./", path) { path = p; } if self.args.mmap() { @@ -268,7 +271,7 @@ impl Worker { } WorkReady::PathFile(path, file) => { let mut path = &*path; - if let Ok(p) = path.strip_prefix("./") { + if let Some(p) = strip_prefix("./", path) { path = p; } if self.args.mmap() { |