summaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-03-13 20:38:50 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-03-13 22:55:39 -0400
commitcd08707c7c82058559bd5557efb3c1d0379dbf1d (patch)
tree37b7094ef1b753f1a2dc090b10badeef693e3c69 /src/args.rs
parentc2e97cd858fd5a18bcfe31979dbd5d859cb240aa (diff)
grep: upgrade to regex-syntax 0.5
This update brings with it many bug fixes: * Better error messages are printed overall. We also include explicit call out for unsupported features like backreferences and look-around. * Regexes like `\s*{` no longer emit incomprehensible errors. * Unicode escape sequences, such as `\u{..}` are now supported. For the most part, this upgrade was done in a straight-forward way. We resist the urge to refactor the `grep` crate, in anticipation of it being rewritten anyway. Note that we removed the `--fixed-strings` suggestion whenever a regex syntax error occurs. In practice, I've found that it results in a lot of false positives, and I believe that its use is not as paramount now that regex parse errors are much more readable. Closes #268, Closes #395, Closes #702, Closes #853
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/args.rs b/src/args.rs
index c7b31dd3..2bbabf1a 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -9,7 +9,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use clap;
use encoding_rs::Encoding;
-use grep::{Grep, GrepBuilder, Error as GrepError};
+use grep::{Grep, GrepBuilder};
use log;
use num_cpus;
use regex;
@@ -882,16 +882,7 @@ impl<'a> ArgMatches<'a> {
if let Some(limit) = self.regex_size_limit()? {
gb = gb.size_limit(limit);
}
- gb.build().map_err(|err| {
- match err {
- GrepError::Regex(err) => {
- let s = format!("{}\n(Hint: Try the --fixed-strings flag \
- to search for a literal string.)", err.to_string());
- From::from(s)
- },
- err => From::from(err)
- }
- })
+ Ok(gb.build()?)
}
/// Builds the set of glob overrides from the command line flags.