Skip to content

New array syntax and rustc serialize update #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ version = "0.2"
optional = true

[dependencies]
rustc-serialize = "0.1"
rustc-serialize = "0.2"
16 changes: 7 additions & 9 deletions src/encode_sets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

// Generated by make_encode_sets.py

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


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


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


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


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


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


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


4 changes: 2 additions & 2 deletions src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum Host {
/// A 128 bit IPv6 address
#[deriving(Clone, Eq, PartialEq, Copy)]
pub struct Ipv6Address {
pub pieces: [u16, ..8]
pub pieces: [u16; 8]
}


Expand Down Expand Up @@ -245,7 +245,7 @@ impl Show for Ipv6Address {
}


fn longest_zero_sequence(pieces: &[u16, ..8]) -> (int, int) {
fn longest_zero_sequence(pieces: &[u16; 8]) -> (int, int) {
let mut longest = -1;
let mut longest_length = -1;
let mut start = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/percent_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod encode_sets;
/// explaining the use case.
#[deriving(Copy)]
pub struct EncodeSet {
map: &'static [&'static str, ..256],
map: &'static [&'static str; 256],
}

/// This encode set is used for fragment identifier and non-relative scheme data.
Expand Down
4 changes: 2 additions & 2 deletions src/punycode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ fn value_to_digit(value: u32, output: &mut String) {
#[cfg(test)]
mod tests {
use super::{decode, encode_str};
use rustc_serialize::json::{from_str, Json, Object};
use rustc_serialize::json::{Json, Object};

fn one_test(description: &str, decoded: &str, encoded: &str) {
match decode(encoded) {
Expand Down Expand Up @@ -250,7 +250,7 @@ mod tests {
#[test]
fn test_punycode() {

match from_str(include_str!("punycode_tests.json")) {
match Json::from_str(include_str!("punycode_tests.json")) {
Ok(Json::Array(tests)) => for test in tests.iter() {
match test {
&Json::Object(ref o) => one_test(
Expand Down