Follow rust std: int, uint were renamed to isize, usize

This commit is contained in:
Thomas Bahn
2015-02-06 14:14:35 +01:00
parent 3b5d71fbb5
commit 361acd37d0
15 changed files with 443 additions and 443 deletions
+41 -41
View File
@@ -362,7 +362,7 @@ mod tests {
#[derive_deserialize]
enum Animal {
Dog,
Frog(String, Vec<int>)
Frog(String, Vec<isize>)
}
impl ToJson for Animal {
@@ -391,7 +391,7 @@ mod tests {
#[derive_deserialize]
struct Inner {
a: (),
b: uint,
b: usize,
c: Vec<string::String>,
}
@@ -464,9 +464,9 @@ mod tests {
#[test]
fn test_write_i64() {
let tests = &[
(3i, "3"),
(-2i, "-2"),
(-1234i, "-1234"),
(3is, "3"),
(-2is, "-2"),
(-1234is, "-1234"),
];
test_encode_ok(tests);
test_pretty_encode_ok(tests);
@@ -643,14 +643,14 @@ mod tests {
fn test_write_tuple() {
test_encode_ok(&[
(
(5i,),
(5is,),
"[5]",
),
]);
test_pretty_encode_ok(&[
(
(5i,),
(5is,),
concat!(
"[\n",
" 5\n",
@@ -661,14 +661,14 @@ mod tests {
test_encode_ok(&[
(
(5i, (6i, "abc")),
(5is, (6is, "abc")),
"[5,[6,\"abc\"]]",
),
]);
test_pretty_encode_ok(&[
(
(5i, (6i, "abc")),
(5is, (6is, "abc")),
concat!(
"[\n",
" 5,\n",
@@ -964,19 +964,19 @@ mod tests {
]);
test_parse_ok(&[
("[3,1]", vec!(3i, 1)),
("[ 3 , 1 ]", vec!(3i, 1)),
("[3,1]", vec!(3is, 1)),
("[ 3 , 1 ]", vec!(3is, 1)),
]);
test_parse_ok(&[
("[[3], [1, 2]]", vec!(vec!(3i), vec!(1, 2))),
("[[3], [1, 2]]", vec!(vec!(3is), vec!(1, 2))),
]);
let v: () = from_str("[]").unwrap();
assert_eq!(v, ());
test_parse_ok(&[
("[1, 2, 3]", (1u, 2u, 3u)),
("[1, 2, 3]", (1us, 2us, 3us)),
]);
}
@@ -992,17 +992,17 @@ mod tests {
]);
test_json_deserialize_ok(&[
vec!(3i, 1),
vec!(3is, 1),
]);
test_json_deserialize_ok(&[
vec!(vec!(3i), vec!(1, 2)),
vec!(vec!(3is), vec!(1, 2)),
]);
}
#[test]
fn test_parse_object() {
test_parse_err::<BTreeMap<string::String, int>>(&[
test_parse_err::<BTreeMap<string::String, isize>>(&[
("{", SyntaxError(EOFWhileParsingString, 1, 2)),
("{ ", SyntaxError(EOFWhileParsingString, 1, 3)),
("{1", SyntaxError(KeyMustBeAString, 1, 2)),
@@ -1022,26 +1022,26 @@ mod tests {
("{ }", treemap!()),
(
"{\"a\":3}",
treemap!("a".to_string() => 3i)
treemap!("a".to_string() => 3is)
),
(
"{ \"a\" : 3 }",
treemap!("a".to_string() => 3i)
treemap!("a".to_string() => 3is)
),
(
"{\"a\":3,\"b\":4}",
treemap!("a".to_string() => 3i, "b".to_string() => 4)
treemap!("a".to_string() => 3is, "b".to_string() => 4)
),
(
"{ \"a\" : 3 , \"b\" : 4 }",
treemap!("a".to_string() => 3i, "b".to_string() => 4),
treemap!("a".to_string() => 3is, "b".to_string() => 4),
),
]);
test_parse_ok(&[
(
"{\"a\": {\"b\": 3, \"c\": 4}}",
treemap!("a".to_string() => treemap!("b".to_string() => 3i, "c".to_string() => 4i)),
treemap!("a".to_string() => treemap!("b".to_string() => 3is, "c".to_string() => 4is)),
),
]);
}
@@ -1050,12 +1050,12 @@ mod tests {
fn test_json_deserialize_object() {
test_json_deserialize_ok(&[
treemap!(),
treemap!("a".to_string() => 3i),
treemap!("a".to_string() => 3i, "b".to_string() => 4),
treemap!("a".to_string() => 3is),
treemap!("a".to_string() => 3is, "b".to_string() => 4),
]);
test_json_deserialize_ok(&[
treemap!("a".to_string() => treemap!("b".to_string() => 3i, "c".to_string() => 4)),
treemap!("a".to_string() => treemap!("b".to_string() => 3is, "c".to_string() => 4)),
]);
}
@@ -1107,7 +1107,7 @@ mod tests {
#[derive_serialize]
#[derive_deserialize]
struct Foo {
x: Option<int>,
x: Option<isize>,
}
let value: Foo = from_str("{}").unwrap();
@@ -1172,7 +1172,7 @@ mod tests {
#[test]
fn test_multiline_errors() {
test_parse_err::<BTreeMap<string::String, string::String>>(&[
("{\n \"foo\":\n \"bar\"", SyntaxError(EOFWhileParsingObject, 3u, 8u)),
("{\n \"foo\":\n \"bar\"", SyntaxError(EOFWhileParsingObject, 3us, 8us)),
]);
}
@@ -1371,7 +1371,7 @@ mod tests {
fn test_encode_hashmap_with_numeric_key() {
use std::str::from_utf8;
use std::collections::HashMap;
let mut hm: HashMap<uint, bool> = HashMap::new();
let mut hm: HashMap<usize, bool> = HashMap::new();
hm.insert(1, true);
let mut mem_buf = MemWriter::new();
{
@@ -1386,7 +1386,7 @@ mod tests {
fn test_prettyencode_hashmap_with_numeric_key() {
use std::str::from_utf8;
use std::collections::HashMap;
let mut hm: HashMap<uint, bool> = HashMap::new();
let mut hm: HashMap<usize, bool> = HashMap::new();
hm.insert(1, true);
let mut mem_buf = MemWriter::new();
{
@@ -1402,7 +1402,7 @@ mod tests {
fn test_hashmap_with_numeric_key_can_handle_double_quote_delimited_key() {
use std::collections::HashMap;
let json_str = "{\"1\":true}";
let map: HashMap<uint, bool> = from_str(json_str).unwrap();
let map: HashMap<usize, bool> = from_str(json_str).unwrap();
let mut m = HashMap::new();
m.insert(1u, true);
assert_eq!(map, m);
@@ -1715,7 +1715,7 @@ mod bench {
})
}
fn json_str(count: uint) -> string::String {
fn json_str(count: usize) -> string::String {
let mut src = "[".to_string();
for _ in range(0, count) {
src.push_str(r#"{"a":true,"b":null,"c":3.1415,"d":"Hello world","e":[1,2,3]},"#);
@@ -1724,7 +1724,7 @@ mod bench {
src
}
fn pretty_json_str(count: uint) -> string::String {
fn pretty_json_str(count: usize) -> string::String {
let mut src = "[\n".to_string();
for _ in range(0, count) {
src.push_str(
@@ -1747,7 +1747,7 @@ mod bench {
src
}
fn encoder_json(count: uint) -> serialize::json::Json {
fn encoder_json(count: usize) -> serialize::json::Json {
use serialize::json::Json;
let mut list = vec!();
@@ -1768,7 +1768,7 @@ mod bench {
Json::Array(list)
}
fn serializer_json(count: uint) -> Value {
fn serializer_json(count: usize) -> Value {
let mut list = vec!();
for _ in range(0, count) {
list.push(Value::Object(treemap!(
@@ -1787,7 +1787,7 @@ mod bench {
Value::Array(list)
}
fn bench_encoder(b: &mut Bencher, count: uint) {
fn bench_encoder(b: &mut Bencher, count: usize) {
let src = json_str(count);
let json = encoder_json(count);
@@ -1796,7 +1796,7 @@ mod bench {
});
}
fn bench_encoder_pretty(b: &mut Bencher, count: uint) {
fn bench_encoder_pretty(b: &mut Bencher, count: usize) {
let src = pretty_json_str(count);
let json = encoder_json(count);
@@ -1805,7 +1805,7 @@ mod bench {
});
}
fn bench_serializer(b: &mut Bencher, count: uint) {
fn bench_serializer(b: &mut Bencher, count: usize) {
let src = json_str(count);
let json = serializer_json(count);
@@ -1814,7 +1814,7 @@ mod bench {
});
}
fn bench_serializer_pretty(b: &mut Bencher, count: uint) {
fn bench_serializer_pretty(b: &mut Bencher, count: usize) {
let src = pretty_json_str(count);
let json = serializer_json(count);
@@ -1823,7 +1823,7 @@ mod bench {
});
}
fn bench_decoder(b: &mut Bencher, count: uint) {
fn bench_decoder(b: &mut Bencher, count: usize) {
let src = json_str(count);
let json = encoder_json(count);
b.iter(|| {
@@ -1831,7 +1831,7 @@ mod bench {
});
}
fn bench_deserializer(b: &mut Bencher, count: uint) {
fn bench_deserializer(b: &mut Bencher, count: usize) {
let src = json_str(count);
let json = encoder_json(count);
b.iter(|| {
@@ -1839,7 +1839,7 @@ mod bench {
});
}
fn bench_decoder_streaming(b: &mut Bencher, count: uint) {
fn bench_decoder_streaming(b: &mut Bencher, count: usize) {
let src = json_str(count);
b.iter( || {
@@ -1878,7 +1878,7 @@ mod bench {
});
}
fn bench_deserializer_streaming(b: &mut Bencher, count: uint) {
fn bench_deserializer_streaming(b: &mut Bencher, count: usize) {
let src = json_str(count);
b.iter( || {