Przeglądaj źródła

Upgrade to rustc 459ffc2adc74f5e8b64a76f5670edb419b9f65da 2014-07-17

Simon Sapin 12 lat temu
rodzic
commit
589e7d6221
4 zmienionych plików z 6 dodań i 7 usunięć
  1. 2 1
      Cargo.toml
  2. 1 2
      src/punycode.rs
  3. 2 2
      src/tests.rs
  4. 1 2
      src/url.rs

+ 2 - 1
Cargo.toml

@@ -6,7 +6,8 @@ authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]
 
 
 [[lib]]
 [[lib]]
 
 
-name = "url"
+name = "url_"
+path = "src/url.rs"
 
 
 [dependencies.encoding]
 [dependencies.encoding]
 
 

+ 1 - 2
src/punycode.rs

@@ -196,14 +196,13 @@ fn value_to_digit(value: u32, output: &mut String) {
 #[cfg(test)]
 #[cfg(test)]
 mod tests {
 mod tests {
     use super::{decode, encode_str};
     use super::{decode, encode_str};
-    use std::str::from_chars;
     use serialize::json::{from_str, List, Object, String};
     use serialize::json::{from_str, List, Object, String};
 
 
     fn one_test(description: &str, decoded: &str, encoded: &str) {
     fn one_test(description: &str, decoded: &str, encoded: &str) {
         match decode(encoded) {
         match decode(encoded) {
             None => fail!("Decoding {} failed.", encoded),
             None => fail!("Decoding {} failed.", encoded),
             Some(result) => {
             Some(result) => {
-                let result = from_chars(result.as_slice());
+                let result = String::from_chars(result.as_slice());
                 assert!(result.as_slice() == decoded,
                 assert!(result.as_slice() == decoded,
                         format!("Incorrect decoding of {}:\n   {}\n!= {}\n{}",
                         format!("Incorrect decoding of {}:\n   {}\n!= {}\n{}",
                                 encoded, result.as_slice(), decoded, description))
                                 encoded, result.as_slice(), decoded, description))

+ 2 - 2
src/tests.rs

@@ -116,14 +116,14 @@ fn parse_test_data(input: &str) -> Vec<Test> {
             continue
             continue
         }
         }
         let mut pieces = line.split(' ').collect::<Vec<&str>>();
         let mut pieces = line.split(' ').collect::<Vec<&str>>();
-        let expected_failure = *pieces.get(0) == "XFAIL";
+        let expected_failure = pieces[0] == "XFAIL";
         if expected_failure {
         if expected_failure {
             pieces.shift();
             pieces.shift();
         }
         }
         let input = unescape(pieces.shift().unwrap());
         let input = unescape(pieces.shift().unwrap());
         let mut test = Test {
         let mut test = Test {
             input: input,
             input: input,
-            base: if pieces.is_empty() || *pieces.get(0) == "" {
+            base: if pieces.is_empty() || pieces[0] == "" {
                 tests.last().unwrap().base.clone()
                 tests.last().unwrap().base.clone()
             } else {
             } else {
                 unescape(pieces.shift().unwrap())
                 unescape(pieces.shift().unwrap())

+ 1 - 2
src/url.rs

@@ -18,7 +18,6 @@ extern crate serialize;
 
 
 use std::cmp;
 use std::cmp;
 use std::hash;
 use std::hash;
-use std::str::from_utf8_lossy;
 use std::ascii::OwnedStrAsciiExt;
 use std::ascii::OwnedStrAsciiExt;
 
 
 use encoding::EncodingRef;
 use encoding::EncodingRef;
@@ -353,7 +352,7 @@ impl Host {
             }
             }
         } else {
         } else {
             let decoded = percent_decode(input.as_bytes());
             let decoded = percent_decode(input.as_bytes());
-            let domain = from_utf8_lossy(decoded.as_slice());
+            let domain = String::from_utf8_lossy(decoded.as_slice());
             // TODO: Remove this check and use IDNA "domain to ASCII"
             // TODO: Remove this check and use IDNA "domain to ASCII"
             if !domain.as_slice().is_ascii() {
             if !domain.as_slice().is_ascii() {
                 Err("Non-ASCII domains (IDNA) are not supported yet.")
                 Err("Non-ASCII domains (IDNA) are not supported yet.")