about summary refs log tree commit diff
path: root/src/libregex
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2014-07-15 11:37:25 +1200
committerNick Cameron <ncameron@mozilla.com>2014-07-17 12:08:31 +1200
commitaa760a849ee9f4d6817c81aad25fdc7990e894ed (patch)
tree8efa4a82b275119ad4733962e5cf1f0fc9117a1e /src/libregex
parentb35d1a8368c7afe0d43dd3e451e884c035afc517 (diff)
downloadrust-aa760a849ee9f4d6817c81aad25fdc7990e894ed.tar.gz
rust-aa760a849ee9f4d6817c81aad25fdc7990e894ed.zip
deprecate Vec::get
Diffstat (limited to 'src/libregex')
-rw-r--r--src/libregex/parse.rs10
-rw-r--r--src/libregex/re.rs12
-rw-r--r--src/libregex/vm.rs12
3 files changed, 17 insertions, 17 deletions
diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs
index 109d32f69b9..d53fed7aa80 100644
--- a/src/libregex/parse.rs
+++ b/src/libregex/parse.rs
@@ -235,7 +235,7 @@ impl<'a> Parser<'a> {
                     // left paren, let's grab the old flags and see if we
                     // need a capture.
                     let (cap, cap_name, oldflags) = {
-                        let paren = self.stack.get(altfrom-1);
+                        let paren = &self.stack[altfrom-1];
                         (paren.capture(), paren.capture_name(), paren.flags())
                     };
                     try!(self.alternate(altfrom));
@@ -464,7 +464,7 @@ impl<'a> Parser<'a> {
                 Some(i) => i,
                 None => return None,
             };
-        if *self.chars.get(closer-1) != ':' {
+        if self.chars[closer-1] != ':' {
             return None
         }
         if closer - self.chari <= 3 {
@@ -519,7 +519,7 @@ impl<'a> Parser<'a> {
             max = Some(min);
         } else {
             let pieces: Vec<&str> = inner.as_slice().splitn(',', 1).collect();
-            let (smin, smax) = (*pieces.get(0), *pieces.get(1));
+            let (smin, smax) = (pieces[0], pieces[1]);
             if smin.len() == 0 {
                 return self.err("Max repetitions cannot be specified \
                                     without min repetitions.")
@@ -931,7 +931,7 @@ impl<'a> Parser<'a> {
         if self.chari + offset >= self.chars.len() {
             return None
         }
-        Some(*self.chars.get(self.chari + offset))
+        Some(self.chars[self.chari + offset])
     }
 
     fn peek_is(&self, offset: uint, is: char) -> bool {
@@ -939,7 +939,7 @@ impl<'a> Parser<'a> {
     }
 
     fn cur(&self) -> char {
-        *self.chars.get(self.chari)
+        self.chars[self.chari]
     }
 
     fn slice(&self, start: uint, end: uint) -> String {
diff --git a/src/libregex/re.rs b/src/libregex/re.rs
index 054cbb0fcd6..8e4145b2a31 100644
--- a/src/libregex/re.rs
+++ b/src/libregex/re.rs
@@ -207,7 +207,7 @@ impl Regex {
     pub fn find(&self, text: &str) -> Option<(uint, uint)> {
         let caps = exec(self, Location, text);
         if has_match(&caps) {
-            Some((caps.get(0).unwrap(), caps.get(1).unwrap()))
+            Some((caps[0].unwrap(), caps[1].unwrap()))
         } else {
             None
         }
@@ -699,11 +699,11 @@ impl<'t> Captures<'t> {
     /// original string matched.
     pub fn pos(&self, i: uint) -> Option<(uint, uint)> {
         let (s, e) = (i * 2, i * 2 + 1);
-        if e >= self.locs.len() || self.locs.get(s).is_none() {
+        if e >= self.locs.len() || self.locs[s].is_none() {
             // VM guarantees that each pair of locations are both Some or None.
             return None
         }
-        Some((self.locs.get(s).unwrap(), self.locs.get(e).unwrap()))
+        Some((self.locs[s].unwrap(), self.locs[e].unwrap()))
     }
 
     /// Returns the matched string for the capture group `i`.
@@ -851,7 +851,7 @@ impl<'r, 't> Iterator<Captures<'t>> for FindCaptures<'r, 't> {
             if !has_match(&caps) {
                 return None
             } else {
-                (caps.get(0).unwrap(), caps.get(1).unwrap())
+                (caps[0].unwrap(), caps[1].unwrap())
             };
 
         // Don't accept empty matches immediately following a match.
@@ -893,7 +893,7 @@ impl<'r, 't> Iterator<(uint, uint)> for FindMatches<'r, 't> {
             if !has_match(&caps) {
                 return None
             } else {
-                (caps.get(0).unwrap(), caps.get(1).unwrap())
+                (caps[0].unwrap(), caps[1].unwrap())
             };
 
         // Don't accept empty matches immediately following a match.
@@ -922,5 +922,5 @@ fn exec_slice(re: &Regex, which: MatchKind,
 
 #[inline]
 fn has_match(caps: &CaptureLocs) -> bool {
-    caps.len() >= 2 && caps.get(0).is_some() && caps.get(1).is_some()
+    caps.len() >= 2 && caps[0].is_some() && caps[1].is_some()
 }
diff --git a/src/libregex/vm.rs b/src/libregex/vm.rs
index 782078ced49..b37000df02d 100644
--- a/src/libregex/vm.rs
+++ b/src/libregex/vm.rs
@@ -123,7 +123,7 @@ impl<'r, 't> Nfa<'r, 't> {
         // Make sure multi-line mode isn't enabled for it, otherwise we can't
         // drop the initial .*?
         let prefix_anchor =
-            match *self.prog.insts.get(1) {
+            match self.prog.insts[1] {
                 EmptyBegin(flags) if flags & FLAG_MULTI == 0 => true,
                 _ => false,
             };
@@ -192,7 +192,7 @@ impl<'r, 't> Nfa<'r, 't> {
     fn step(&self, groups: &mut [Option<uint>], nlist: &mut Threads,
             caps: &mut [Option<uint>], pc: uint)
            -> StepState {
-        match *self.prog.insts.get(pc) {
+        match self.prog.insts[pc] {
             Match => {
                 match self.which {
                     Exists => {
@@ -259,7 +259,7 @@ impl<'r, 't> Nfa<'r, 't> {
         //
         // We make a minor optimization by indicating that the state is "empty"
         // so that its capture groups are not filled in.
-        match *self.prog.insts.get(pc) {
+        match self.prog.insts[pc] {
             EmptyBegin(flags) => {
                 let multi = flags & FLAG_MULTI > 0;
                 nlist.add(pc, groups, true);
@@ -481,8 +481,8 @@ impl Threads {
 
     #[inline]
     fn contains(&self, pc: uint) -> bool {
-        let s = *self.sparse.get(pc);
-        s < self.size && self.queue.get(s).pc == pc
+        let s = self.sparse[pc];
+        s < self.size && self.queue[s].pc == pc
     }
 
     #[inline]
@@ -492,7 +492,7 @@ impl Threads {
 
     #[inline]
     fn pc(&self, i: uint) -> uint {
-        self.queue.get(i).pc
+        self.queue[i].pc
     }
 
     #[inline]