Browse Source

Move platform-specific imports into functions that use them.

Simon Sapin 11 years ago
parent
commit
5b79927a2f
2 changed files with 6 additions and 4 deletions
  1. 1 1
      Cargo.toml
  2. 5 3
      src/lib.rs

+ 1 - 1
Cargo.toml

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

+ 5 - 3
src/lib.rs

@@ -130,9 +130,7 @@ use std::path::{Path, PathBuf};
 pub use host::{Host, Ipv6Address};
 pub use host::{Host, Ipv6Address};
 pub use parser::{ErrorHandler, ParseResult, ParseError};
 pub use parser::{ErrorHandler, ParseResult, ParseError};
 
 
-use percent_encoding::{
-    percent_decode, percent_decode_to, percent_encode, lossy_utf8_percent_decode, DEFAULT_ENCODE_SET,
-};
+use percent_encoding::{percent_encode, lossy_utf8_percent_decode, DEFAULT_ENCODE_SET};
 
 
 use format::{PathFormatter, UserInfoFormatter, UrlNoFragmentFormatter};
 use format::{PathFormatter, UserInfoFormatter, UrlNoFragmentFormatter};
 use encoding::EncodingOverride;
 use encoding::EncodingOverride;
@@ -966,6 +964,8 @@ fn file_url_path_to_pathbuf(path: &[String]) -> Result<PathBuf, ()> {
     use std::os::unix::prelude::OsStrExt;
     use std::os::unix::prelude::OsStrExt;
     use std::path::PathBuf;
     use std::path::PathBuf;
 
 
+    use percent_encoding::percent_decode_to;
+
     if path.is_empty() {
     if path.is_empty() {
         return Ok(PathBuf::from("/"))
         return Ok(PathBuf::from("/"))
     }
     }
@@ -983,6 +983,8 @@ fn file_url_path_to_pathbuf(path: &[String]) -> Result<PathBuf, ()> {
 
 
 #[cfg(windows)]
 #[cfg(windows)]
 fn file_url_path_to_pathbuf(path: &[String]) -> Result<PathBuf, ()> {
 fn file_url_path_to_pathbuf(path: &[String]) -> Result<PathBuf, ()> {
+    use percent_encoding::percent_decode;
+
     if path.is_empty() {
     if path.is_empty() {
         return Err(())
         return Err(())
     }
     }