avm2: Remove `ArrayIterator` trait.

I originally added this with the anticipation that `impl` return syntax only allowed one trait plus OIBITs. This was prior experience in Rust but apparantly the compiler accepts this just fine, so I suppose my defensive coding practice was a bad/outdated idea.
This commit is contained in:
David Wendt 2020-09-14 21:33:26 -04:00 committed by Mike Welsh
parent de0bc93839
commit 27eda5cdf1
1 changed files with 5 additions and 9 deletions

View File

@ -5,14 +5,6 @@ use gc_arena::Collect;
use std::iter::ExactSizeIterator; use std::iter::ExactSizeIterator;
use std::ops::RangeBounds; use std::ops::RangeBounds;
/// Trait which exists purely so that we can reverse the iterators that come
/// out of `ArrayStorage.iter`.
///
/// Not to be confused with the `ArrayIterator` struct in `globals::array`.
pub trait ArrayIterator: DoubleEndedIterator + ExactSizeIterator {}
impl<T> ArrayIterator for T where T: DoubleEndedIterator + ExactSizeIterator {}
/// The array storage portion of an array object. /// The array storage portion of an array object.
/// ///
/// Array values may consist of either standard `Value`s or "holes": values /// Array values may consist of either standard `Value`s or "holes": values
@ -156,7 +148,11 @@ impl<'gc> ArrayStorage<'gc> {
} }
/// Iterate over array values. /// Iterate over array values.
pub fn iter<'a>(&'a self) -> impl ArrayIterator<Item = Option<Value<'gc>>> + 'a { pub fn iter<'a>(
&'a self,
) -> impl DoubleEndedIterator<Item = Option<Value<'gc>>>
+ ExactSizeIterator<Item = Option<Value<'gc>>>
+ 'a {
self.storage.iter().cloned() self.storage.iter().cloned()
} }