Skip to content

Commit 5ef17e9

Browse files
committed
Merge pull request #69 from Nercury/new-array-syntax-and-rustc-serialize
New array syntax and rustc serialize update
2 parents 09a5b07 + daabb29 commit 5ef17e9

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ version = "0.2"
2121
optional = true
2222

2323
[dependencies]
24-
rustc-serialize = "0.1"
24+
rustc-serialize = "0.2"

src/encode_sets.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// Generated by make_encode_sets.py
1010

11-
pub static SIMPLE: [&'static str, ..256] = [
11+
pub static SIMPLE: [&'static str; 256] = [
1212
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
1313
"%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",
1414
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
@@ -44,7 +44,7 @@ pub static SIMPLE: [&'static str, ..256] = [
4444
];
4545

4646

47-
pub static QUERY: [&'static str, ..256] = [
47+
pub static QUERY: [&'static str; 256] = [
4848
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
4949
"%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",
5050
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
@@ -80,7 +80,7 @@ pub static QUERY: [&'static str, ..256] = [
8080
];
8181

8282

83-
pub static DEFAULT: [&'static str, ..256] = [
83+
pub static DEFAULT: [&'static str; 256] = [
8484
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
8585
"%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",
8686
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
@@ -116,7 +116,7 @@ pub static DEFAULT: [&'static str, ..256] = [
116116
];
117117

118118

119-
pub static USERINFO: [&'static str, ..256] = [
119+
pub static USERINFO: [&'static str; 256] = [
120120
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
121121
"%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",
122122
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
@@ -152,7 +152,7 @@ pub static USERINFO: [&'static str, ..256] = [
152152
];
153153

154154

155-
pub static PASSWORD: [&'static str, ..256] = [
155+
pub static PASSWORD: [&'static str; 256] = [
156156
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
157157
"%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",
158158
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
@@ -188,7 +188,7 @@ pub static PASSWORD: [&'static str, ..256] = [
188188
];
189189

190190

191-
pub static USERNAME: [&'static str, ..256] = [
191+
pub static USERNAME: [&'static str; 256] = [
192192
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
193193
"%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",
194194
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
@@ -224,7 +224,7 @@ pub static USERNAME: [&'static str, ..256] = [
224224
];
225225

226226

227-
pub static FORM_URLENCODED: [&'static str, ..256] = [
227+
pub static FORM_URLENCODED: [&'static str; 256] = [
228228
"%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
229229
"%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",
230230
"%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
@@ -258,5 +258,3 @@ pub static FORM_URLENCODED: [&'static str, ..256] = [
258258
"%F0", "%F1", "%F2", "%F3", "%F4", "%F5", "%F6", "%F7",
259259
"%F8", "%F9", "%FA", "%FB", "%FC", "%FD", "%FE", "%FF",
260260
];
261-
262-

src/host.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub enum Host {
3232
/// A 128 bit IPv6 address
3333
#[deriving(Clone, Eq, PartialEq, Copy)]
3434
pub struct Ipv6Address {
35-
pub pieces: [u16, ..8]
35+
pub pieces: [u16; 8]
3636
}
3737

3838

@@ -245,7 +245,7 @@ impl Show for Ipv6Address {
245245
}
246246

247247

248-
fn longest_zero_sequence(pieces: &[u16, ..8]) -> (int, int) {
248+
fn longest_zero_sequence(pieces: &[u16; 8]) -> (int, int) {
249249
let mut longest = -1;
250250
let mut longest_length = -1;
251251
let mut start = -1;

src/percent_encoding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mod encode_sets;
2929
/// explaining the use case.
3030
#[deriving(Copy)]
3131
pub struct EncodeSet {
32-
map: &'static [&'static str, ..256],
32+
map: &'static [&'static str; 256],
3333
}
3434

3535
/// This encode set is used for fragment identifier and non-relative scheme data.

src/punycode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ fn value_to_digit(value: u32, output: &mut String) {
216216
#[cfg(test)]
217217
mod tests {
218218
use super::{decode, encode_str};
219-
use rustc_serialize::json::{from_str, Json, Object};
219+
use rustc_serialize::json::{Json, Object};
220220

221221
fn one_test(description: &str, decoded: &str, encoded: &str) {
222222
match decode(encoded) {
@@ -250,7 +250,7 @@ mod tests {
250250
#[test]
251251
fn test_punycode() {
252252

253-
match from_str(include_str!("punycode_tests.json")) {
253+
match Json::from_str(include_str!("punycode_tests.json")) {
254254
Ok(Json::Array(tests)) => for test in tests.iter() {
255255
match test {
256256
&Json::Object(ref o) => one_test(

0 commit comments

Comments
 (0)