1
Fork 0

fixes/improvements thanks to @Manishearth

This commit is contained in:
Andre Bogus 2015-09-08 01:03:01 +02:00
parent 9cca96545f
commit 808390817a
3 changed files with 4 additions and 6 deletions

View file

@ -1324,7 +1324,7 @@ impl Stack {
pub fn is_equal_to(&self, rhs: &[StackElement]) -> bool {
if self.stack.len() != rhs.len() { return false; }
for (i, r) in rhs.iter().enumerate() {
if &self.get(i) != r { return false; }
if self.get(i) != *r { return false; }
}
true
}
@ -1334,7 +1334,7 @@ impl Stack {
pub fn starts_with(&self, rhs: &[StackElement]) -> bool {
if self.stack.len() < rhs.len() { return false; }
for (i, r) in rhs.iter().enumerate() {
if &self.get(i) != r { return false; }
if self.get(i) != *r { return false; }
}
true
}
@ -1345,7 +1345,7 @@ impl Stack {
if self.stack.len() < rhs.len() { return false; }
let offset = self.stack.len() - rhs.len();
for (i, r) in rhs.iter().enumerate() {
if &self.get(i + offset) != r { return false; }
if self.get(i + offset) != *r { return false; }
}
true
}

View file

@ -141,8 +141,7 @@ pub fn split_paths(unparsed: &OsStr) -> SplitPaths {
fn is_colon(b: &u8) -> bool { *b == b':' }
let unparsed = unparsed.as_bytes();
SplitPaths {
iter: unparsed.split(is_colon as fn(&u8) -> bool)
.map(bytes_to_path as fn(&[u8]) -> PathBuf)
iter: unparsed.split(is_colon).map(bytes_to_path)
}
}

View file

@ -169,7 +169,6 @@ impl Stats for [f64] {
// This inner loop applies `hi`/`lo` summation to each
// partial so that the list of partial sums remains exact.
for mut y in &mut partials {
let mut y: f64 = partials[i];
if x.abs() < y.abs() {
mem::swap(&mut x, &mut y);
}