Jelajahi Sumber

Fix for upstream changes

Steven Fackler 11 tahun lalu
induk
melakukan
5a029d99a6
6 mengubah file dengan 33 tambahan dan 33 penghapusan
  1. 2 2
      src/encoding.rs
  2. 10 10
      src/format.rs
  3. 8 8
      src/host.rs
  4. 9 9
      src/lib.rs
  5. 3 3
      src/parser.rs
  6. 1 1
      src/percent_encoding.rs

+ 2 - 2
src/encoding.rs

@@ -19,7 +19,7 @@ use std::borrow::Cow;
 #[cfg(feature = "query_encoding")] pub use self::encoding::types::EncodingRef;
 #[cfg(feature = "query_encoding")] pub use self::encoding::types::EncodingRef;
 
 
 #[cfg(feature = "query_encoding")]
 #[cfg(feature = "query_encoding")]
-#[deriving(Copy)]
+#[derive(Copy)]
 pub struct EncodingOverride {
 pub struct EncodingOverride {
     /// `None` means UTF-8.
     /// `None` means UTF-8.
     encoding: Option<EncodingRef>
     encoding: Option<EncodingRef>
@@ -70,7 +70,7 @@ impl EncodingOverride {
 
 
 
 
 #[cfg(not(feature = "query_encoding"))]
 #[cfg(not(feature = "query_encoding"))]
-#[deriving(Copy)]
+#[derive(Copy)]
 pub struct EncodingOverride;
 pub struct EncodingOverride;
 
 
 #[cfg(not(feature = "query_encoding"))]
 #[cfg(not(feature = "query_encoding"))]

+ 10 - 10
src/format.rs

@@ -12,7 +12,7 @@
 //!
 //!
 //! You can use `<formatter>.to_string()`, as the formatters implement `Show`.
 //! You can use `<formatter>.to_string()`, as the formatters implement `Show`.
 
 
-use std::fmt::{mod, Show, Formatter};
+use std::fmt::{self, Show, Formatter};
 use super::Url;
 use super::Url;
 
 
 /// Formatter and serializer for URL path data.
 /// Formatter and serializer for URL path data.
@@ -24,7 +24,7 @@ pub struct PathFormatter<'a, T:'a> {
 impl<'a, T: Str + Show> Show for PathFormatter<'a, T> {
 impl<'a, T: Str + Show> Show for PathFormatter<'a, T> {
     fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
     fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
         if self.path.is_empty() {
         if self.path.is_empty() {
-            formatter.write(b"/")
+            formatter.write_str("/")
         } else {
         } else {
             for path_part in self.path.iter() {
             for path_part in self.path.iter() {
                 try!("/".fmt(formatter));
                 try!("/".fmt(formatter));
@@ -50,15 +50,15 @@ pub struct UserInfoFormatter<'a> {
 impl<'a> Show for UserInfoFormatter<'a> {
 impl<'a> Show for UserInfoFormatter<'a> {
     fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
     fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
         if !self.username.is_empty() || self.password.is_some() {
         if !self.username.is_empty() || self.password.is_some() {
-            try!(formatter.write(self.username.as_bytes()));
+            try!(formatter.write_str(self.username));
             match self.password {
             match self.password {
                 None => (),
                 None => (),
                 Some(password) => {
                 Some(password) => {
-                    try!(formatter.write(b":"));
-                    try!(formatter.write(password.as_bytes()));
+                    try!(formatter.write_str(":"));
+                    try!(formatter.write_str(password));
                 }
                 }
             }
             }
-            try!(formatter.write(b"@"));
+            try!(formatter.write_str("@"));
         }
         }
         Ok(())
         Ok(())
     }
     }
@@ -72,14 +72,14 @@ pub struct UrlNoFragmentFormatter<'a> {
 
 
 impl<'a> Show for UrlNoFragmentFormatter<'a> {
 impl<'a> Show for UrlNoFragmentFormatter<'a> {
     fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
     fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
-        try!(formatter.write(self.url.scheme.as_bytes()));
-        try!(formatter.write(b":"));
+        try!(formatter.write_str(self.url.scheme.as_slice()));
+        try!(formatter.write_str(":"));
         try!(self.url.scheme_data.fmt(formatter));
         try!(self.url.scheme_data.fmt(formatter));
         match self.url.query {
         match self.url.query {
             None => (),
             None => (),
             Some(ref query) => {
             Some(ref query) => {
-                try!(formatter.write(b"?"));
-                try!(formatter.write(query.as_bytes()));
+                try!(formatter.write_str("?"));
+                try!(formatter.write_str(query.as_slice()));
             }
             }
         }
         }
         Ok(())
         Ok(())

+ 8 - 8
src/host.rs

@@ -8,13 +8,13 @@
 
 
 use std::ascii::{AsciiExt, OwnedAsciiExt};
 use std::ascii::{AsciiExt, OwnedAsciiExt};
 use std::cmp;
 use std::cmp;
-use std::fmt::{mod, Formatter, Show};
+use std::fmt::{self, Formatter, Show};
 use parser::{ParseResult, ParseError};
 use parser::{ParseResult, ParseError};
 use percent_encoding::{from_hex, percent_decode};
 use percent_encoding::{from_hex, percent_decode};
 
 
 
 
 /// The host name of an URL.
 /// The host name of an URL.
-#[deriving(PartialEq, Eq, Clone)]
+#[derive(PartialEq, Eq, Clone)]
 pub enum Host {
 pub enum Host {
     /// A (DNS) domain name or an IPv4 address.
     /// A (DNS) domain name or an IPv4 address.
     ///
     ///
@@ -30,7 +30,7 @@ pub enum Host {
 
 
 
 
 /// A 128 bit IPv6 address
 /// A 128 bit IPv6 address
-#[deriving(Clone, Eq, PartialEq, Copy)]
+#[derive(Clone, Eq, PartialEq, Copy)]
 pub struct Ipv6Address {
 pub struct Ipv6Address {
     pub pieces: [u16; 8]
     pub pieces: [u16; 8]
 }
 }
@@ -82,9 +82,9 @@ impl Show for Host {
         match *self {
         match *self {
             Host::Domain(ref domain) => domain.fmt(formatter),
             Host::Domain(ref domain) => domain.fmt(formatter),
             Host::Ipv6(ref address) => {
             Host::Ipv6(ref address) => {
-                try!(formatter.write(b"["));
+                try!(formatter.write_str("["));
                 try!(address.fmt(formatter));
                 try!(address.fmt(formatter));
-                formatter.write(b"]")
+                formatter.write_str("]")
             }
             }
         }
         }
     }
     }
@@ -224,9 +224,9 @@ impl Show for Ipv6Address {
         let mut i = 0;
         let mut i = 0;
         while i < 8 {
         while i < 8 {
             if i == compress_start {
             if i == compress_start {
-                try!(formatter.write(b":"));
+                try!(formatter.write_str(":"));
                 if i == 0 {
                 if i == 0 {
-                    try!(formatter.write(b":"));
+                    try!(formatter.write_str(":"));
                 }
                 }
                 if compress_end < 8 {
                 if compress_end < 8 {
                     i = compress_end;
                     i = compress_end;
@@ -236,7 +236,7 @@ impl Show for Ipv6Address {
             }
             }
             try!(write!(formatter, "{:x}", self.pieces[i as uint]));
             try!(write!(formatter, "{:x}", self.pieces[i as uint]));
             if i < 7 {
             if i < 7 {
-                try!(formatter.write(b":"));
+                try!(formatter.write_str(":"));
             }
             }
             i += 1;
             i += 1;
         }
         }

+ 9 - 9
src/lib.rs

@@ -119,11 +119,11 @@ assert!(css_url.serialize() == "http://servo.github.io/rust-url/main.css".to_str
 */
 */
 
 
 
 
-#![feature(macro_rules, default_type_params)]
+#![feature(macro_rules, default_type_params, old_orphan_check)]
 
 
 extern crate "rustc-serialize" as rustc_serialize;
 extern crate "rustc-serialize" as rustc_serialize;
 
 
-use std::fmt::{mod, Formatter, Show};
+use std::fmt::{self, Formatter, Show};
 use std::hash;
 use std::hash;
 use std::path;
 use std::path;
 
 
@@ -155,7 +155,7 @@ mod tests;
 
 
 
 
 /// The parsed representation of an absolute URL.
 /// The parsed representation of an absolute URL.
-#[deriving(PartialEq, Eq, Clone)]
+#[derive(PartialEq, Eq, Clone)]
 pub struct Url {
 pub struct Url {
     /// The scheme (a.k.a. protocol) of the URL, in ASCII lower case.
     /// The scheme (a.k.a. protocol) of the URL, in ASCII lower case.
     pub scheme: String,
     pub scheme: String,
@@ -186,7 +186,7 @@ pub struct Url {
 }
 }
 
 
 /// The components of the URL whose representation depends on where the scheme is *relative*.
 /// The components of the URL whose representation depends on where the scheme is *relative*.
-#[deriving(PartialEq, Eq, Clone)]
+#[derive(PartialEq, Eq, Clone)]
 pub enum SchemeData {
 pub enum SchemeData {
     /// Components for URLs in a *relative* scheme such as HTTP.
     /// Components for URLs in a *relative* scheme such as HTTP.
     Relative(RelativeSchemeData),
     Relative(RelativeSchemeData),
@@ -200,7 +200,7 @@ pub enum SchemeData {
 }
 }
 
 
 /// Components for URLs in a *relative* scheme such as HTTP.
 /// Components for URLs in a *relative* scheme such as HTTP.
-#[deriving(PartialEq, Eq, Clone)]
+#[derive(PartialEq, Eq, Clone)]
 pub struct RelativeSchemeData {
 pub struct RelativeSchemeData {
     /// The username of the URL, as a possibly empty, pecent-encoded string.
     /// The username of the URL, as a possibly empty, pecent-encoded string.
     ///
     ///
@@ -403,7 +403,7 @@ impl<'a> UrlParser<'a> {
 
 
 
 
 /// Determines the behavior of the URL parser for a given scheme.
 /// Determines the behavior of the URL parser for a given scheme.
-#[deriving(PartialEq, Eq, Copy)]
+#[derive(PartialEq, Eq, Copy)]
 pub enum SchemeType {
 pub enum SchemeType {
     /// Indicate that the scheme is *non-relative*.
     /// Indicate that the scheme is *non-relative*.
     ///
     ///
@@ -772,8 +772,8 @@ impl Show for Url {
         match self.fragment {
         match self.fragment {
             None => (),
             None => (),
             Some(ref fragment) => {
             Some(ref fragment) => {
-                try!(formatter.write(b"#"));
-                try!(formatter.write(fragment.as_bytes()));
+                try!(formatter.write_str("#"));
+                try!(formatter.write_str(fragment.as_slice()));
             }
             }
         }
         }
         Ok(())
         Ok(())
@@ -889,7 +889,7 @@ impl RelativeSchemeData {
 impl Show for RelativeSchemeData {
 impl Show for RelativeSchemeData {
     fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
     fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
         // Write the scheme-trailing double slashes.
         // Write the scheme-trailing double slashes.
-        try!(formatter.write(b"//"));
+        try!(formatter.write_str("//"));
 
 
         // Write the user info.
         // Write the user info.
         try!(UserInfoFormatter {
         try!(UserInfoFormatter {

+ 3 - 3
src/parser.rs

@@ -8,7 +8,7 @@
 
 
 use std::ascii::AsciiExt;
 use std::ascii::AsciiExt;
 use std::error::Error;
 use std::error::Error;
-use std::fmt::{mod, Formatter, Show};
+use std::fmt::{self, Formatter, Show};
 use std::str::CharRange;
 use std::str::CharRange;
 
 
 use super::{UrlParser, Url, SchemeData, RelativeSchemeData, Host, SchemeType};
 use super::{UrlParser, Url, SchemeData, RelativeSchemeData, Host, SchemeType};
@@ -31,7 +31,7 @@ pub type ParseResult<T> = Result<T, ParseError>;
 macro_rules! simple_enum_error {
 macro_rules! simple_enum_error {
     ($($name: ident => $description: expr,)+) => {
     ($($name: ident => $description: expr,)+) => {
         /// Errors that can occur during parsing.
         /// Errors that can occur during parsing.
-        #[deriving(PartialEq, Eq, Clone, Copy)]
+        #[derive(PartialEq, Eq, Clone, Copy)]
         pub enum ParseError {
         pub enum ParseError {
             $(
             $(
                 $name,
                 $name,
@@ -92,7 +92,7 @@ impl Show for ParseError {
 pub type ErrorHandler = fn(reason: ParseError) -> ParseResult<()>;
 pub type ErrorHandler = fn(reason: ParseError) -> ParseResult<()>;
 
 
 
 
-#[deriving(PartialEq, Eq)]
+#[derive(PartialEq, Eq)]
 pub enum Context {
 pub enum Context {
     UrlParser,
     UrlParser,
     Setter,
     Setter,

+ 1 - 1
src/percent_encoding.rs

@@ -27,7 +27,7 @@ mod encode_sets;
 /// If you need a different encode set,
 /// If you need a different encode set,
 /// please [file a bug](https://github.com/servo/rust-url/issues)
 /// please [file a bug](https://github.com/servo/rust-url/issues)
 /// explaining the use case.
 /// explaining the use case.
-#[deriving(Copy)]
+#[derive(Copy)]
 pub struct EncodeSet {
 pub struct EncodeSet {
     map: &'static [&'static str; 256],
     map: &'static [&'static str; 256],
 }
 }