summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2016-03-30 20:44:26 -0400
committerAndrew Gallant <jamslam@gmail.com>2016-03-30 20:44:26 -0400
commitf1a91307cd0826d5009fe0046dfb4e91bf9c4608 (patch)
treeb3bb3a4030414e4437e24aaf452eadcd0104b37a /src
parent79a51029c104ad543dfed310b6c5f762dd4052a2 (diff)
short matches
Diffstat (limited to 'src')
-rw-r--r--src/search.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/search.rs b/src/search.rs
index f47feae3..d73a9f56 100644
--- a/src/search.rs
+++ b/src/search.rs
@@ -101,12 +101,12 @@ impl<'b, 's> Iter<'b, 's> {
}
if let Some(ref req) = self.searcher.required {
while self.start < self.buf.len() {
- let (s, e) = match req.find(&self.buf[self.start..]) {
+ let e = match req.shortest_match(&self.buf[self.start..]) {
None => return None,
- Some((s, e)) => (self.start + s, self.start + e),
+ Some(e) => self.start + e,
};
- let (prevnl, nextnl) = self.find_line(s, e);
- match self.searcher.re.find(&self.buf[prevnl..nextnl]) {
+ let (prevnl, nextnl) = self.find_line(e, e);
+ match self.searcher.re.shortest_match(&self.buf[prevnl..nextnl]) {
None => {
self.start = nextnl + 1;
continue;
@@ -116,11 +116,11 @@ impl<'b, 's> Iter<'b, 's> {
}
None
} else {
- let (s, e) = match self.searcher.re.find(&self.buf[self.start..]) {
+ let e = match self.searcher.re.shortest_match(&self.buf[self.start..]) {
None => return None,
- Some((s, e)) => (self.start + s, self.start + e),
+ Some(e) => self.start + e,
};
- Some(self.find_line(s, e))
+ Some(self.find_line(e, e))
}
}