diff --git a/benches/bench_enum.rs b/benches/bench_enum.rs index d76dae15..62e02e42 100644 --- a/benches/bench_enum.rs +++ b/benches/bench_enum.rs @@ -150,12 +150,13 @@ mod decoder { _f: |&mut AnimalDecoder| -> Result) -> Result { Err(SyntaxError) } - fn read_tuple(&mut self, _f: |&mut AnimalDecoder, uint| -> Result) -> Result { Err(SyntaxError) } + fn read_tuple(&mut self, _len: uint, _f: |&mut AnimalDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_arg(&mut self, _a_idx: uint, _f: |&mut AnimalDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_struct(&mut self, _s_name: &str, - _f: |&mut AnimalDecoder, uint| -> Result) + _len: uint, + _f: |&mut AnimalDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_struct_arg(&mut self, _a_idx: uint, diff --git a/benches/bench_log.rs b/benches/bench_log.rs index feafe19b..09c50efb 100644 --- a/benches/bench_log.rs +++ b/benches/bench_log.rs @@ -569,10 +569,10 @@ fn push_all_bytes(dst: &mut Vec, 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( diff --git a/benches/bench_map.rs b/benches/bench_map.rs index 7e84e3b0..82143989 100644 --- a/benches/bench_map.rs +++ b/benches/bench_map.rs @@ -28,7 +28,7 @@ pub enum Error { mod decoder { use std::collections::HashMap; - use std::collections::hashmap::MoveEntries; + use std::collections::hash_map::MoveEntries; use serialize; use super::{Error, EndOfStream, SyntaxError, OtherError}; @@ -122,12 +122,13 @@ mod decoder { _f: |&mut IntDecoder| -> Result) -> Result { Err(SyntaxError) } - fn read_tuple(&mut self, _f: |&mut IntDecoder, uint| -> Result) -> Result { Err(SyntaxError) } + fn read_tuple(&mut self, _len: uint, _f: |&mut IntDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_arg(&mut self, _a_idx: uint, _f: |&mut IntDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_struct(&mut self, _s_name: &str, - _f: |&mut IntDecoder, uint| -> Result) + _len: uint, + _f: |&mut IntDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_struct_arg(&mut self, _a_idx: uint, @@ -169,7 +170,7 @@ mod decoder { mod deserializer { use std::collections::HashMap; - use std::collections::hashmap::MoveEntries; + use std::collections::hash_map::MoveEntries; use super::{Error, EndOfStream, SyntaxError}; diff --git a/benches/bench_struct.rs b/benches/bench_struct.rs index 4632e0e3..24a80412 100644 --- a/benches/bench_struct.rs +++ b/benches/bench_struct.rs @@ -191,12 +191,13 @@ mod decoder { } } - fn read_tuple(&mut self, _f: |&mut OuterDecoder, uint| -> Result) -> Result { Err(SyntaxError("".to_string())) } + fn read_tuple(&mut self, _len: uint, _f: |&mut OuterDecoder| -> Result) -> Result { Err(SyntaxError("".to_string())) } fn read_tuple_arg(&mut self, _a_idx: uint, _f: |&mut OuterDecoder| -> Result) -> Result { Err(SyntaxError("".to_string())) } fn read_tuple_struct(&mut self, _s_name: &str, - _f: |&mut OuterDecoder, uint| -> Result) + _len: uint, + _f: |&mut OuterDecoder| -> Result) -> Result { Err(SyntaxError("".to_string())) } fn read_tuple_struct_arg(&mut self, _a_idx: uint, diff --git a/benches/bench_vec.rs b/benches/bench_vec.rs index d447450d..f063c446 100644 --- a/benches/bench_vec.rs +++ b/benches/bench_vec.rs @@ -105,12 +105,13 @@ mod decoder { _f: |&mut IntDecoder| -> Result) -> Result { Err(SyntaxError) } - fn read_tuple(&mut self, _f: |&mut IntDecoder, uint| -> Result) -> Result { Err(SyntaxError) } + fn read_tuple(&mut self, _len: uint, _f: |&mut IntDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_arg(&mut self, _a_idx: uint, _f: |&mut IntDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_struct(&mut self, _s_name: &str, - _f: |&mut IntDecoder, uint| -> Result) + _len: uint, + _f: |&mut IntDecoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_struct_arg(&mut self, _a_idx: uint, @@ -211,12 +212,13 @@ mod decoder { _f: |&mut U8Decoder| -> Result) -> Result { Err(SyntaxError) } - fn read_tuple(&mut self, _f: |&mut U8Decoder, uint| -> Result) -> Result { Err(SyntaxError) } + fn read_tuple(&mut self, _len: uint, _f: |&mut U8Decoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_arg(&mut self, _a_idx: uint, _f: |&mut U8Decoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_struct(&mut self, _s_name: &str, - _f: |&mut U8Decoder, uint| -> Result) + _len: uint, + _f: |&mut U8Decoder| -> Result) -> Result { Err(SyntaxError) } fn read_tuple_struct_arg(&mut self, _a_idx: uint, diff --git a/src/de.rs b/src/de.rs index eea56021..2fa78ae6 100644 --- a/src/de.rs +++ b/src/de.rs @@ -364,10 +364,10 @@ pub trait Deserializer: Iterator> { Ok(None) } Str(n) => { - Ok(Some(fields.iter().position(|field| **field == n))) + Ok(Some(fields.iter().position(|field| *field == n))) } String(n) => { - Ok(Some(fields.iter().position(|field| **field == n.as_slice()))) + Ok(Some(fields.iter().position(|field| *field == n.as_slice()))) } token => { Err(self.syntax_error(token, STR_TOKEN_KINDS)) @@ -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) } diff --git a/src/json/mod.rs b/src/json/mod.rs index 09ddf2d9..a89049a7 100644 --- a/src/json/mod.rs +++ b/src/json/mod.rs @@ -264,7 +264,7 @@ fn main() { */ use std::char; -use std::collections::{HashMap, TreeMap, treemap}; +use std::collections::{HashMap, TreeMap, tree_map}; use std::f32; use std::f64; use std::fmt; @@ -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; @@ -573,7 +573,7 @@ impl, E> de::Deserializable for Json { enum JsonDeserializerState { JsonDeserializerValueState(Json), JsonDeserializerListState(vec::MoveItems), - JsonDeserializerObjectState(treemap::MoveEntries), + JsonDeserializerObjectState(tree_map::MoveEntries), JsonDeserializerEndState, } @@ -2237,7 +2237,7 @@ impl> de::Deserializer for Parser { None => { return Ok(None); } }; - Ok(Some(fields.iter().position(|field| **field == s.as_slice()))) + Ok(Some(fields.iter().position(|field| *field == s.as_slice()))) } }