Skip to content

Commit

Permalink
core: use iterators for slice equality comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
aschampion committed Jun 8, 2019
1 parent 30b27f3 commit d482589
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5294,13 +5294,7 @@ impl<A, B> SlicePartialEq<B> for [A]
return false;
}

for i in 0..self.len() {
if !self[i].eq(&other[i]) {
return false;
}
}

true
self.iter().zip(other.iter()).all(|(x, y)| x == y)
}
}

Expand All @@ -5317,13 +5311,7 @@ impl<A> SlicePartialEq<A> for [A]
return true;
}

for i in 0..self.len() {
if !self[i].eq(&other[i]) {
return false;
}
}

true
self.iter().zip(other.iter()).all(|(x, y)| x == y)
}
}

Expand Down

0 comments on commit d482589

Please sign in to comment.