Skip to content

Commit 82422a8

Browse files
committed
Seems I got the order of setting and getting sizes wrong…
1 parent f5e50f1 commit 82422a8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/parser.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,10 @@ impl<'a> Parser<'a> {
745745
b'\"' => expect_string!(self)
746746
};
747747

748-
self.depth += 1;
749-
750748
let mut object = Object::with_capacity(self.get_alloc_size());
751749

750+
self.depth += 1;
751+
752752
expect!(self, b':');
753753

754754
object.insert(key, expect_value!(self));
@@ -778,9 +778,10 @@ impl<'a> Parser<'a> {
778778
fn read_array(&mut self) -> Result<Vec<JsonValue>> {
779779
let first = expect_value!{ self, b']' => return Ok(Vec::new()) };
780780

781+
let mut array = Vec::with_capacity(self.get_alloc_size());
782+
781783
self.depth += 1;
782784

783-
let mut array = Vec::with_capacity(self.get_alloc_size());
784785
array.push(first);
785786

786787
loop {

0 commit comments

Comments
 (0)