Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 5ad3371

Browse files
committed
Bump to 0.2.15
1 parent 04d9cfe commit 5ad3371

File tree

5 files changed

+22
-26
lines changed

5 files changed

+22
-26
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "rustc-serialize"
4-
version = "0.2.14"
4+
version = "0.2.15"
55
authors = ["The Rust Project Developers"]
66
license = "MIT/Apache-2.0"
77
readme = "README.md"

src/collection_impls.rs

+14-18
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
//! Implementations of serialization for structures found in libcollections
1212
1313
use std::default::Default;
14-
use std::hash::{Hash, Hasher};
14+
use std::hash::Hash;
1515

1616
use {Decodable, Encodable, Decoder, Encoder};
17-
use std::collections::{DList, RingBuf, BTreeMap, BTreeSet, HashMap, HashSet, VecMap};
17+
use std::collections::{LinkedList, VecDeque, BTreeMap, BTreeSet, HashMap, HashSet, VecMap};
1818
use std::collections::hash_state::HashState;
1919

2020
impl<
2121
T: Encodable
22-
> Encodable for DList<T> {
22+
> Encodable for LinkedList<T> {
2323
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
2424
s.emit_seq(self.len(), |s| {
2525
for (i, e) in self.iter().enumerate() {
@@ -30,10 +30,10 @@ impl<
3030
}
3131
}
3232

33-
impl<T:Decodable> Decodable for DList<T> {
34-
fn decode<D: Decoder>(d: &mut D) -> Result<DList<T>, D::Error> {
33+
impl<T:Decodable> Decodable for LinkedList<T> {
34+
fn decode<D: Decoder>(d: &mut D) -> Result<LinkedList<T>, D::Error> {
3535
d.read_seq(|d, len| {
36-
let mut list = DList::new();
36+
let mut list = LinkedList::new();
3737
for i in 0..len {
3838
list.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
3939
}
@@ -42,7 +42,7 @@ impl<T:Decodable> Decodable for DList<T> {
4242
}
4343
}
4444

45-
impl<T: Encodable> Encodable for RingBuf<T> {
45+
impl<T: Encodable> Encodable for VecDeque<T> {
4646
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
4747
s.emit_seq(self.len(), |s| {
4848
for (i, e) in self.iter().enumerate() {
@@ -53,10 +53,10 @@ impl<T: Encodable> Encodable for RingBuf<T> {
5353
}
5454
}
5555

56-
impl<T:Decodable> Decodable for RingBuf<T> {
57-
fn decode<D: Decoder>(d: &mut D) -> Result<RingBuf<T>, D::Error> {
56+
impl<T:Decodable> Decodable for VecDeque<T> {
57+
fn decode<D: Decoder>(d: &mut D) -> Result<VecDeque<T>, D::Error> {
5858
d.read_seq(|d, len| {
59-
let mut deque: RingBuf<T> = RingBuf::new();
59+
let mut deque: VecDeque<T> = VecDeque::new();
6060
for i in 0..len {
6161
deque.push_back(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
6262
}
@@ -129,10 +129,9 @@ impl<
129129
}
130130

131131
impl<K, V, S> Encodable for HashMap<K, V, S>
132-
where K: Encodable + Hash< <S as HashState>::Hasher> + Eq,
132+
where K: Encodable + Hash + Eq,
133133
V: Encodable,
134134
S: HashState,
135-
<S as HashState>::Hasher: Hasher<Output=u64>
136135
{
137136
fn encode<E: Encoder>(&self, e: &mut E) -> Result<(), E::Error> {
138137
e.emit_map(self.len(), |e| {
@@ -148,10 +147,9 @@ impl<K, V, S> Encodable for HashMap<K, V, S>
148147
}
149148

150149
impl<K, V, S> Decodable for HashMap<K, V, S>
151-
where K: Decodable + Hash< <S as HashState>::Hasher> + Eq,
150+
where K: Decodable + Hash + Eq,
152151
V: Decodable,
153152
S: HashState + Default,
154-
<S as HashState>::Hasher: Hasher<Output=u64>
155153
{
156154
fn decode<D: Decoder>(d: &mut D) -> Result<HashMap<K, V, S>, D::Error> {
157155
d.read_map(|d, len| {
@@ -168,9 +166,8 @@ impl<K, V, S> Decodable for HashMap<K, V, S>
168166
}
169167

170168
impl<T, S> Encodable for HashSet<T, S>
171-
where T: Encodable + Hash< <S as HashState>::Hasher> + Eq,
169+
where T: Encodable + Hash + Eq,
172170
S: HashState,
173-
<S as HashState>::Hasher: Hasher<Output=u64>
174171
{
175172
fn encode<E: Encoder>(&self, s: &mut E) -> Result<(), E::Error> {
176173
s.emit_seq(self.len(), |s| {
@@ -185,9 +182,8 @@ impl<T, S> Encodable for HashSet<T, S>
185182
}
186183

187184
impl<T, S> Decodable for HashSet<T, S>
188-
where T: Decodable + Hash< <S as HashState>::Hasher> + Eq,
185+
where T: Decodable + Hash + Eq,
189186
S: HashState + Default,
190-
<S as HashState>::Hasher: Hasher<Output=u64>
191187
{
192188
fn decode<D: Decoder>(d: &mut D) -> Result<HashSet<T, S>, D::Error> {
193189
d.read_seq(|d, len| {

src/json.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ impl Json {
10451045
/// Returns None otherwise.
10461046
pub fn as_string<'a>(&'a self) -> Option<&'a str> {
10471047
match *self {
1048-
Json::String(ref s) => Some(&s[]),
1048+
Json::String(ref s) => Some(&s),
10491049
_ => None
10501050
}
10511051
}
@@ -2140,7 +2140,7 @@ impl ::Decoder for Decoder {
21402140
return Err(ExpectedError("String or Object".to_string(), format!("{}", json)))
21412141
}
21422142
};
2143-
let idx = match names.iter().position(|n| *n == &name[]) {
2143+
let idx = match names.iter().position(|n| *n == name) {
21442144
Some(idx) => idx,
21452145
None => return Err(UnknownVariantError(name))
21462146
};
@@ -3366,7 +3366,7 @@ mod tests {
33663366
hm.insert(1, true);
33673367
let mut mem_buf = Vec::new();
33683368
write!(&mut mem_buf, "{}", super::as_pretty_json(&hm)).unwrap();
3369-
let json_str = from_utf8(&mem_buf[]).unwrap();
3369+
let json_str = from_utf8(&mem_buf).unwrap();
33703370
match Json::from_str(json_str) {
33713371
Err(_) => panic!("Unable to parse json_str: {}", json_str),
33723372
_ => {} // it parsed and we are good to go
@@ -3382,7 +3382,7 @@ mod tests {
33823382
hm.insert(1, true);
33833383
let mut mem_buf = Vec::new();
33843384
write!(&mut mem_buf, "{}", super::as_pretty_json(&hm)).unwrap();
3385-
let json_str = from_utf8(&mem_buf[]).unwrap();
3385+
let json_str = from_utf8(&mem_buf).unwrap();
33863386
match Json::from_str(json_str) {
33873387
Err(_) => panic!("Unable to parse json_str: {}", json_str),
33883388
_ => {} // it parsed and we are good to go
@@ -3422,7 +3422,7 @@ mod tests {
34223422
write!(&mut writer, "{}",
34233423
super::as_pretty_json(&json).indent(i as u32)).unwrap();
34243424

3425-
let printed = from_utf8(&writer[]).unwrap();
3425+
let printed = from_utf8(&writer).unwrap();
34263426

34273427
// Check for indents at each line
34283428
let lines: Vec<&str> = printed.lines().collect();

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! Support code for encoding and decoding types.
1212
13-
#![feature(core, collections, unicode, io, std_misc, path, hash, os)]
13+
#![feature(core, collections, unicode, old_io, std_misc, old_path, path, os)]
1414
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1515
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
1616
html_root_url = "http://doc.rust-lang.org/rustc-serialize/")]

src/serialize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl Encodable for str {
328328

329329
impl Encodable for String {
330330
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
331-
s.emit_str(&self[])
331+
s.emit_str(self)
332332
}
333333
}
334334

0 commit comments

Comments
 (0)