fix partial performance hit: 163ns vs 200ns

This commit is contained in:
Erick Tryzelaar 2014-05-19 08:22:18 -07:00
parent 6d13ee2ec8
commit 989b6c5282

5
de.rs
View File

@ -468,6 +468,7 @@ mod tests {
struct IntsDeserializer { struct IntsDeserializer {
state: IntsDeserializerState, state: IntsDeserializerState,
len: uint,
iter: vec::MoveItems<int>, iter: vec::MoveItems<int>,
value: Option<int> value: Option<int>
} }
@ -477,6 +478,7 @@ mod tests {
fn new(values: Vec<int>) -> IntsDeserializer { fn new(values: Vec<int>) -> IntsDeserializer {
IntsDeserializer { IntsDeserializer {
state: Start, state: Start,
len: values.len(),
iter: values.move_iter(), iter: values.move_iter(),
value: None, value: None,
} }
@ -489,8 +491,7 @@ mod tests {
match self.state { match self.state {
Start => { Start => {
self.state = Sep; self.state = Sep;
let (lower, _) = self.iter.size_hint(); Some(Ok(CollectionStart(self.len)))
Some(Ok(CollectionStart(lower)))
} }
Sep => { Sep => {
match self.iter.next() { match self.iter.next() {