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