From c34bc0f1008f5549ca113007ecc7dd4f9f35467b Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Wed, 2 Oct 2019 13:07:37 +0200 Subject: [PATCH] Remove cfg-if dependency This is to allow the crate to compile with rustc 1.13. --- Cargo.toml | 1 - src/lib.rs | 45 +++++++++++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4084026..6802d55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,5 +10,4 @@ maintenance = { status = "actively-developed" } keywords = ["xdg", "basedir", "app_dirs", "path", "folder"] [dependencies] -cfg-if = "=0.1.9" dirs-sys = "0.3.5" diff --git a/src/lib.rs b/src/lib.rs index 669f73d..e3c2232 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,26 +13,35 @@ #![deny(missing_docs)] -#[macro_use] -extern crate cfg_if; - use std::path::PathBuf; -cfg_if! { - if #[cfg(target_os = "windows")] { - mod win; - use win as sys; - } else if #[cfg(any(target_os = "macos", target_os = "ios"))] { - mod mac; - use mac as sys; - } else if #[cfg(target_arch = "wasm32")] { - mod wasm; - use wasm as sys; - } else { - mod lin; - use lin as sys; - } -} +#[cfg(target_os = "windows")] +mod win; +#[cfg(target_os = "windows")] +use win as sys; + +#[cfg(any(target_os = "macos", target_os = "ios"))] +mod mac; +#[cfg(any(target_os = "macos", target_os = "ios"))] +use mac as sys; + +#[cfg(target_arch = "wasm32")] +mod wasm; +#[cfg(target_arch = "wasm32")] +use wasm as sys; + +#[cfg(not(any( + target_os = "windows", + target_os = "macos", target_os = "ios", + target_arch = "wasm32" +)))] +mod lin; +#[cfg(not(any( + target_os = "windows", + target_os = "macos", target_os = "ios", + target_arch = "wasm32" +)))] +use lin as sys; /// Returns the path to the user's home directory. ///