diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index d8f053eb54d..bb514639777 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -51,7 +51,6 @@ use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::ImageCacheThread; use net_traits::response::HttpsState; use profile_traits::mem; -use std::any::Any; use std::collections::HashMap; use std::sync::mpsc::{Sender, Receiver}; use url::Url; diff --git a/components/util/Cargo.toml b/components/util/Cargo.toml index c8857fcfa2e..80ea5a45397 100644 --- a/components/util/Cargo.toml +++ b/components/util/Cargo.toml @@ -30,6 +30,8 @@ serde = "0.7" serde_macros = "0.7" smallvec = "0.1" url = {version = "1.0.0", features = ["heap_size", "serde"]} + +[target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))'.dependencies] xdg = "2.0" [target.'cfg(windows)'.dependencies] diff --git a/components/util/basedir.rs b/components/util/basedir.rs index 3a91b5e1f66..733bcd69507 100644 --- a/components/util/basedir.rs +++ b/components/util/basedir.rs @@ -6,27 +6,27 @@ //! For linux based platforms, it uses the XDG base directory spec but provides //! similar abstractions for non-linux platforms. -extern crate xdg; - +#[cfg(any(target_os = "macos", target_os = "windows"))] use std::env; -use std::fs; use std::path::PathBuf; +#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))] +use xdg; -#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "windows")))] +#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))] pub fn default_config_dir() -> Option { let xdg_dirs = xdg::BaseDirectories::with_profile("servo", "default").unwrap(); let config_dir = xdg_dirs.get_config_home(); Some(config_dir) } -#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "windows")))] +#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))] pub fn default_data_dir() -> Option { let xdg_dirs = xdg::BaseDirectories::with_profile("servo", "default").unwrap(); let data_dir = xdg_dirs.get_data_home(); Some(data_dir) } -#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "windows")))] +#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))] pub fn default_cache_dir() -> Option { let xdg_dirs = xdg::BaseDirectories::with_profile("servo", "default").unwrap(); let cache_dir = xdg_dirs.get_cache_home(); diff --git a/components/util/lib.rs b/components/util/lib.rs index 680e5609da0..9407b18a87b 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -38,6 +38,7 @@ extern crate rustc_serialize; extern crate serde; extern crate smallvec; extern crate url; +#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))] extern crate xdg; use std::sync::Arc;