deprecate Vec::get

This commit is contained in:
Nick Cameron
2014-07-15 11:37:25 +12:00
parent b35d1a8368
commit aa760a849e
25 changed files with 91 additions and 88 deletions

View File

@@ -154,7 +154,7 @@ impl Iterator<Path> for Paths {
if self.require_dir && !path.is_dir() { continue; }
return Some(path);
}
let ref pattern = *self.dir_patterns.get(idx);
let ref pattern = self.dir_patterns[idx];
if pattern.matches_with(match path.filename_str() {
// this ugly match needs to go here to avoid a borrowck error
@@ -250,21 +250,21 @@ impl Pattern {
let mut i = 0;
while i < chars.len() {
match *chars.get(i) {
match chars[i] {
'?' => {
tokens.push(AnyChar);
i += 1;
}
'*' => {
// *, **, ***, ****, ... are all equivalent
while i < chars.len() && *chars.get(i) == '*' {
while i < chars.len() && chars[i] == '*' {
i += 1;
}
tokens.push(AnySequence);
}
'[' => {
if i <= chars.len() - 4 && *chars.get(i + 1) == '!' {
if i <= chars.len() - 4 && chars[i + 1] == '!' {
match chars.slice_from(i + 3).position_elem(&']') {
None => (),
Some(j) => {
@@ -276,7 +276,7 @@ impl Pattern {
}
}
}
else if i <= chars.len() - 3 && *chars.get(i + 1) != '!' {
else if i <= chars.len() - 3 && chars[i + 1] != '!' {
match chars.slice_from(i + 2).position_elem(&']') {
None => (),
Some(j) => {
@@ -507,7 +507,7 @@ fn fill_todo(todo: &mut Vec<(Path, uint)>, patterns: &[Pattern], idx: uint, path
// the current and parent directory respectively requires that
// the pattern has a leading dot, even if the `MatchOptions` field
// `require_literal_leading_dot` is not set.
if pattern.tokens.len() > 0 && pattern.tokens.get(0) == &Char('.') {
if pattern.tokens.len() > 0 && pattern.tokens[0] == Char('.') {
for &special in [".", ".."].iter() {
if pattern.matches_with(special, options) {
add(todo, path.join(special));