From e658ff7822116eeb1a5b1adc5f8d08b7fa10a96d Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Aug 2019 12:31:15 +0700 Subject: [PATCH] ci: Add Mac and Windows builds --- .travis.yml | 31 ++++++++++++++++++++++++++++++- src/lib.rs | 9 ++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 193e015fb46..a34d64d774e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,32 @@ +dist: xenial language: rust rust: - - stable \ No newline at end of file + - stable + +git: + depth: 1 + quiet: true + +matrix: + fast_finish: true + include: + - os: linux + env: TARGET=x86_64-unknown-linux-gnu + + - os: osx + osx_image: xcode9.2 + env: MACOSX_DEPLOYMENT_TARGET=10.7 TARGET=x86_64-apple-darwin + + - os: windows + env: TARGET=x86_64-pc-windows-msvc EXE_EXT=.exe + services: nil + + - name: rustfmt + install: + - rustup component add rustfmt + script: + - cargo fmt --all -- --check + +script: + - cargo build --verbose + - cargo test --verbose diff --git a/src/lib.rs b/src/lib.rs index 2a60dba99a0..7876ca56db2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,7 @@ //! [rust-lang/rust#43321]: https://github.com/rust-lang/rust/issues/43321 #![deny(rust_2018_idioms)] -#![allow(deprecated)] // uses std::env::home_dir when necessary +#![allow(deprecated)] // uses env::home_dir when necessary use std::env; use std::io; @@ -68,7 +68,6 @@ pub fn home_dir() -> Option { #[cfg(windows)] fn home_dir_() -> Option { - use scopeguard; use std::ptr; use winapi::shared::winerror::ERROR_INSUFFICIENT_BUFFER; use winapi::um::errhandlingapi::GetLastError; @@ -77,7 +76,7 @@ fn home_dir_() -> Option { use winapi::um::userenv::GetUserProfileDirectoryW; use winapi::um::winnt::TOKEN_READ; - std::env::var_os("USERPROFILE") + env::var_os("USERPROFILE") .map(PathBuf::from) .or_else(|| unsafe { let me = GetCurrentProcess(); @@ -162,7 +161,7 @@ where #[cfg(any(unix, target_os = "redox"))] fn home_dir_() -> Option { - std::env::home_dir() + env::home_dir() } /// Returns the storage directory used by Cargo, often knowns as @@ -217,7 +216,7 @@ pub fn cargo_home_with_cwd(cwd: &Path) -> io::Result { let user_home = home_dir.map(|p| p.join(".cargo")); // Compatibility with old cargo that used the std definition of home_dir - let compat_home_dir = std::env::home_dir(); + let compat_home_dir = env::home_dir(); let compat_user_home = compat_home_dir.map(|p| p.join(".cargo")); if let Some(p) = env_cargo_home {