style: Remove needless and bogus bounds-check.

The check should read index >= self.len(). But it doesn't matter anyway since
we're covered by Rust's bound checks by default anyway.
This commit is contained in:
Emilio Cobos Álvarez 2017-12-21 04:07:28 +01:00
parent fd6847fd76
commit 40b9d78a34
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -15,9 +15,6 @@ use std::slice::{Iter, IterMut};
impl<T> Index<usize> for nsStyleAutoArray<T> {
type Output = T;
fn index(&self, index: usize) -> &T {
if index > self.len() {
panic!("out of range")
}
match index {
0 => &self.mFirstElement,
_ => &self.mOtherElements[index - 1],
@ -27,9 +24,6 @@ impl<T> Index<usize> for nsStyleAutoArray<T> {
impl<T> IndexMut<usize> for nsStyleAutoArray<T> {
fn index_mut(&mut self, index: usize) -> &mut T {
if index > self.len() {
panic!("out of range")
}
match index {
0 => &mut self.mFirstElement,
_ => &mut self.mOtherElements[index - 1],