Fix new deprecations from collections reform

This commit is contained in:
Renato Zannon 2014-11-07 18:28:31 -02:00
parent ba67a8b3b2
commit bad51b197f
3 changed files with 9 additions and 9 deletions

View File

@ -569,10 +569,10 @@ fn push_all_bytes(dst: &mut Vec<u8>, src: &[u8]) {
let dst_len = dst.len();
let src_len = src.len();
dst.reserve_additional(src_len);
dst.reserve(src_len);
unsafe {
// we would have failed if `reserve_additional` overflowed.
// we would have failed if `reserve` overflowed.
dst.set_len(dst_len + src_len);
::std::ptr::copy_nonoverlapping_memory(

View File

@ -882,27 +882,27 @@ impl GatherTokens {
self.gather(d)
}
EnumStart(name, variant, len) => {
self.tokens.reserve_additional(len + 1);
self.tokens.reserve(len + 1);
self.tokens.push(EnumStart(name, variant, len));
self.gather_seq(d)
}
StructStart(name, len) => {
self.tokens.reserve_additional(len + 1);
self.tokens.reserve(len + 1);
self.tokens.push(StructStart(name, len));
self.gather_struct(d)
}
TupleStart(len) => {
self.tokens.reserve_additional(len + 1);
self.tokens.reserve(len + 1);
self.tokens.push(TupleStart(len));
self.gather_seq(d)
}
SeqStart(len) => {
self.tokens.reserve_additional(len + 1);
self.tokens.reserve(len + 1);
self.tokens.push(SeqStart(len));
self.gather_seq(d)
}
MapStart(len) => {
self.tokens.reserve_additional(len + 1);
self.tokens.reserve(len + 1);
self.tokens.push(MapStart(len));
self.gather_map(d)
}

View File

@ -324,7 +324,7 @@ impl Json {
/// Otherwise, returns None.
pub fn find<'a>(&'a self, key: &string::String) -> Option<&'a Json>{
match self {
&Object(ref map) => map.find(key),
&Object(ref map) => map.get(key),
_ => None
}
}
@ -349,7 +349,7 @@ impl Json {
pub fn search<'a>(&'a self, key: &string::String) -> Option<&'a Json> {
match self {
&Object(ref map) => {
match map.find(key) {
match map.get(key) {
Some(json_value) => Some(json_value),
None => {
let mut value : Option<&'a Json> = None;