Jelajahi Sumber

Upgrade to rustc 1.0.0-nightly (522d09dfe 2015-02-19) (built 2015-02-20)

Simon Sapin 11 tahun lalu
induk
melakukan
6a20f9b270
7 mengubah file dengan 14 tambahan dan 14 penghapusan
  1. 1 1
      Cargo.toml
  2. 2 2
      src/encoding.rs
  3. 1 1
      src/form_urlencoded.rs
  4. 1 1
      src/host.rs
  5. 4 4
      src/lib.rs
  6. 1 1
      src/parser.rs
  7. 4 4
      src/tests.rs

+ 1 - 1
Cargo.toml

@@ -1,7 +1,7 @@
 [package]
 [package]
 
 
 name = "url"
 name = "url"
-version = "0.2.20"
+version = "0.2.21"
 authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]
 authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]
 
 
 description = "URL parser for Rust"
 description = "URL parser for Rust"

+ 2 - 2
src/encoding.rs

@@ -59,7 +59,7 @@ impl EncodingOverride {
         }
         }
     }
     }
 
 
-    pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, Vec<u8>, [u8]> {
+    pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, [u8]> {
         match self.encoding {
         match self.encoding {
             Some(encoding) => Cow::Owned(
             Some(encoding) => Cow::Owned(
                 encoding.encode(input, EncoderTrap::NcrEscape).unwrap()),
                 encoding.encode(input, EncoderTrap::NcrEscape).unwrap()),
@@ -91,7 +91,7 @@ impl EncodingOverride {
         String::from_utf8_lossy(input).into_owned()
         String::from_utf8_lossy(input).into_owned()
     }
     }
 
 
-    pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, Vec<u8>, [u8]> {
+    pub fn encode<'a>(&self, input: &'a str) -> Cow<'a, [u8]> {
         Cow::Borrowed(input.as_bytes())
         Cow::Borrowed(input.as_bytes())
     }
     }
 }
 }

+ 1 - 1
src/form_urlencoded.rs

@@ -56,7 +56,7 @@ fn parse_internal(input: &[u8], mut encoding_override: EncodingOverride, mut use
         if !piece.is_empty() {
         if !piece.is_empty() {
             let (name, value) = match piece.position_elem(&b'=') {
             let (name, value) = match piece.position_elem(&b'=') {
                 Some(position) => (&piece[..position], &piece[position + 1..]),
                 Some(position) => (&piece[..position], &piece[position + 1..]),
-                None => (piece, &[][])
+                None => (piece, &[][..])
             };
             };
 
 
             #[inline]
             #[inline]

+ 1 - 1
src/host.rs

@@ -60,7 +60,7 @@ impl Host {
                 Err(ParseError::NonAsciiDomainsNotSupportedYet)
                 Err(ParseError::NonAsciiDomainsNotSupportedYet)
             } else if domain.find(&[
             } else if domain.find(&[
                 '\0', '\t', '\n', '\r', ' ', '#', '%', '/', ':', '?', '@', '[', '\\', ']'
                 '\0', '\t', '\n', '\r', ' ', '#', '%', '/', ':', '?', '@', '[', '\\', ']'
-            ][]).is_some() {
+            ][..]).is_some() {
                 Err(ParseError::InvalidDomainCharacter)
                 Err(ParseError::InvalidDomainCharacter)
             } else {
             } else {
                 Ok(Host::Domain(domain.to_string().into_ascii_lowercase()))
                 Ok(Host::Domain(domain.to_string().into_ascii_lowercase()))

+ 4 - 4
src/lib.rs

@@ -119,7 +119,7 @@ assert!(css_url.serialize() == "http://servo.github.io/rust-url/main.css".to_str
 */
 */
 
 
 
 
-#![feature(core, std_misc, collections, path, hash)]
+#![feature(core, std_misc, collections, old_path)]
 
 
 extern crate "rustc-serialize" as rustc_serialize;
 extern crate "rustc-serialize" as rustc_serialize;
 
 
@@ -242,8 +242,8 @@ pub struct RelativeSchemeData {
     pub path: Vec<String>,
     pub path: Vec<String>,
 }
 }
 
 
-impl<H: hash::Hasher + hash::Writer> hash::Hash<H> for Url {
-    fn hash(&self, state: &mut H) {
+impl hash::Hash for Url {
+    fn hash<H: hash::Hasher>(&self, state: &mut H) {
         self.serialize().hash(state)
         self.serialize().hash(state)
     }
     }
 }
 }
@@ -983,7 +983,7 @@ impl FromUrlPath for path::windows::Path {
         if path.is_empty() {
         if path.is_empty() {
             return Err(())
             return Err(())
         }
         }
-        let prefix = &path[0][];
+        let prefix = &*path[0];
         if prefix.len() != 2 || !parser::starts_with_ascii_alpha(prefix)
         if prefix.len() != 2 || !parser::starts_with_ascii_alpha(prefix)
                 || prefix.as_bytes()[1] != b':' {
                 || prefix.as_bytes()[1] != b':' {
             return Err(())
             return Err(())

+ 1 - 1
src/parser.rs

@@ -93,7 +93,7 @@ pub enum Context {
 
 
 
 
 pub fn parse_url(input: &str, parser: &UrlParser) -> ParseResult<Url> {
 pub fn parse_url(input: &str, parser: &UrlParser) -> ParseResult<Url> {
-    let input = input.trim_matches(&[' ', '\t', '\n', '\r', '\x0C'][]);
+    let input = input.trim_matches(&[' ', '\t', '\n', '\r', '\x0C'][..]);
     let (scheme, remaining) = match parse_scheme(input, Context::UrlParser) {
     let (scheme, remaining) = match parse_scheme(input, Context::UrlParser) {
         Some((scheme, remaining)) => (scheme, remaining),
         Some((scheme, remaining)) => (scheme, remaining),
         // No-scheme state
         // No-scheme state

+ 4 - 4
src/tests.rs

@@ -209,7 +209,7 @@ fn file_paths() {
 
 
     let mut url = Url::from_file_path(&path::posix::Path::new("/foo/bar")).unwrap();
     let mut url = Url::from_file_path(&path::posix::Path::new("/foo/bar")).unwrap();
     assert_eq!(url.host(), Some(&Host::Domain("".to_string())));
     assert_eq!(url.host(), Some(&Host::Domain("".to_string())));
-    assert_eq!(url.path(), Some(&["foo".to_string(), "bar".to_string()][]));
+    assert_eq!(url.path(), Some(&["foo".to_string(), "bar".to_string()][..]));
     assert!(url.to_file_path() == Ok(path::posix::Path::new("/foo/bar")));
     assert!(url.to_file_path() == Ok(path::posix::Path::new("/foo/bar")));
 
 
     url.path_mut().unwrap()[1] = "ba\0r".to_string();
     url.path_mut().unwrap()[1] = "ba\0r".to_string();
@@ -225,7 +225,7 @@ fn file_paths() {
 
 
     let mut url = Url::from_file_path(&path::windows::Path::new(r"C:\foo\bar")).unwrap();
     let mut url = Url::from_file_path(&path::windows::Path::new(r"C:\foo\bar")).unwrap();
     assert_eq!(url.host(), Some(&Host::Domain("".to_string())));
     assert_eq!(url.host(), Some(&Host::Domain("".to_string())));
-    assert_eq!(url.path(), Some(&["C:".to_string(), "foo".to_string(), "bar".to_string()][]));
+    assert_eq!(url.path(), Some(&["C:".to_string(), "foo".to_string(), "bar".to_string()][..]));
     assert!(url.to_file_path::<path::windows::Path>()
     assert!(url.to_file_path::<path::windows::Path>()
             == Ok(path::windows::Path::new(r"C:\foo\bar")));
             == Ok(path::windows::Path::new(r"C:\foo\bar")));
 
 
@@ -252,10 +252,10 @@ fn directory_paths() {
 
 
     let url = Url::from_directory_path(&path::posix::Path::new("/foo/bar")).unwrap();
     let url = Url::from_directory_path(&path::posix::Path::new("/foo/bar")).unwrap();
     assert_eq!(url.host(), Some(&Host::Domain("".to_string())));
     assert_eq!(url.host(), Some(&Host::Domain("".to_string())));
-    assert_eq!(url.path(), Some(&["foo".to_string(), "bar".to_string(), "".to_string()][]));
+    assert_eq!(url.path(), Some(&["foo".to_string(), "bar".to_string(), "".to_string()][..]));
 
 
     let url = Url::from_directory_path(&path::windows::Path::new(r"C:\foo\bar")).unwrap();
     let url = Url::from_directory_path(&path::windows::Path::new(r"C:\foo\bar")).unwrap();
     assert_eq!(url.host(), Some(&Host::Domain("".to_string())));
     assert_eq!(url.host(), Some(&Host::Domain("".to_string())));
     assert_eq!(url.path(), Some(&[
     assert_eq!(url.path(), Some(&[
-        "C:".to_string(), "foo".to_string(), "bar".to_string(), "".to_string()][]));
+        "C:".to_string(), "foo".to_string(), "bar".to_string(), "".to_string()][..]));
 }
 }