]> git.lizzy.rs Git - rust.git/commitdiff
Fix up remaining usage of `to_ascii`.
authorSimon Sapin <simon.sapin@exyr.org>
Thu, 25 Dec 2014 14:26:16 +0000 (15:26 +0100)
committerSimon Sapin <simon.sapin@exyr.org>
Thu, 25 Dec 2014 14:26:16 +0000 (15:26 +0100)
src/compiletest/runtest.rs

index bf72250c4705af70e5e43d64cf8eafb9f4e8e917..1abcd8bd214075ecd264622abeea789b207264ab 100644 (file)
@@ -21,6 +21,8 @@
 #[cfg(target_os = "windows")]
 use util;
 
+#[cfg(target_os = "windows")]
+use std::ascii::AsciiExt;
 use std::io::File;
 use std::io::fs::PathExtensions;
 use std::io::fs;
@@ -985,22 +987,9 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
         format!("{}:{}:", testfile.display(), ee.line)
     }).collect::<Vec<String> >();
 
-    #[cfg(target_os = "windows")]
-    fn to_lower( s : &str ) -> String {
-        let i = s.chars();
-        let c : Vec<char> = i.map( |c| {
-            if c.is_ascii() {
-                c.to_ascii().to_lowercase().as_char()
-            } else {
-                c
-            }
-        } ).collect();
-        String::from_chars(c.as_slice())
-    }
-
     #[cfg(windows)]
     fn prefix_matches( line : &str, prefix : &str ) -> bool {
-        to_lower(line).as_slice().starts_with(to_lower(prefix).as_slice())
+        line.to_ascii_lowercase().starts_with(prefix.to_ascii_lowercase().as_slice())
     }
 
     #[cfg(unix)]