mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #19615 - emilio:useless-check, r=KiChjang
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. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19615) <!-- Reviewable:end -->
This commit is contained in:
commit
6524d22814
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