mirror of
https://github.com/servo/servo.git
synced 2025-07-03 05:23:38 +01:00
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:
parent
fd6847fd76
commit
40b9d78a34
1 changed files with 0 additions and 6 deletions
|
@ -15,9 +15,6 @@ use std::slice::{Iter, IterMut};
|
||||||
impl<T> Index<usize> for nsStyleAutoArray<T> {
|
impl<T> Index<usize> for nsStyleAutoArray<T> {
|
||||||
type Output = T;
|
type Output = T;
|
||||||
fn index(&self, index: usize) -> &T {
|
fn index(&self, index: usize) -> &T {
|
||||||
if index > self.len() {
|
|
||||||
panic!("out of range")
|
|
||||||
}
|
|
||||||
match index {
|
match index {
|
||||||
0 => &self.mFirstElement,
|
0 => &self.mFirstElement,
|
||||||
_ => &self.mOtherElements[index - 1],
|
_ => &self.mOtherElements[index - 1],
|
||||||
|
@ -27,9 +24,6 @@ impl<T> Index<usize> for nsStyleAutoArray<T> {
|
||||||
|
|
||||||
impl<T> IndexMut<usize> for nsStyleAutoArray<T> {
|
impl<T> IndexMut<usize> for nsStyleAutoArray<T> {
|
||||||
fn index_mut(&mut self, index: usize) -> &mut T {
|
fn index_mut(&mut self, index: usize) -> &mut T {
|
||||||
if index > self.len() {
|
|
||||||
panic!("out of range")
|
|
||||||
}
|
|
||||||
match index {
|
match index {
|
||||||
0 => &mut self.mFirstElement,
|
0 => &mut self.mFirstElement,
|
||||||
_ => &mut self.mOtherElements[index - 1],
|
_ => &mut self.mOtherElements[index - 1],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue