Skip to content

Commit 865e4b9

Browse files
authored
Merge pull request rust-lang#10 from lzutao/ci/add-mac-winnt-builds
ci: Add Mac and Windows builds
2 parents 2c718c9 + e658ff7 commit 865e4b9

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

.travis.yml

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
dist: xenial
12
language: rust
23
rust:
3-
- stable
4+
- stable
5+
6+
git:
7+
depth: 1
8+
quiet: true
9+
10+
matrix:
11+
fast_finish: true
12+
include:
13+
- os: linux
14+
env: TARGET=x86_64-unknown-linux-gnu
15+
16+
- os: osx
17+
osx_image: xcode9.2
18+
env: MACOSX_DEPLOYMENT_TARGET=10.7 TARGET=x86_64-apple-darwin
19+
20+
- os: windows
21+
env: TARGET=x86_64-pc-windows-msvc EXE_EXT=.exe
22+
services: nil
23+
24+
- name: rustfmt
25+
install:
26+
- rustup component add rustfmt
27+
script:
28+
- cargo fmt --all -- --check
29+
30+
script:
31+
- cargo build --verbose
32+
- cargo test --verbose

src/lib.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
//! [rust-lang/rust#43321]: https://github.com/rust-lang/rust/issues/43321
2727
2828
#![deny(rust_2018_idioms)]
29-
#![allow(deprecated)] // uses std::env::home_dir when necessary
29+
#![allow(deprecated)] // uses env::home_dir when necessary
3030

3131
use std::env;
3232
use std::io;
@@ -68,7 +68,6 @@ pub fn home_dir() -> Option<PathBuf> {
6868

6969
#[cfg(windows)]
7070
fn home_dir_() -> Option<PathBuf> {
71-
use scopeguard;
7271
use std::ptr;
7372
use winapi::shared::winerror::ERROR_INSUFFICIENT_BUFFER;
7473
use winapi::um::errhandlingapi::GetLastError;
@@ -77,7 +76,7 @@ fn home_dir_() -> Option<PathBuf> {
7776
use winapi::um::userenv::GetUserProfileDirectoryW;
7877
use winapi::um::winnt::TOKEN_READ;
7978

80-
std::env::var_os("USERPROFILE")
79+
env::var_os("USERPROFILE")
8180
.map(PathBuf::from)
8281
.or_else(|| unsafe {
8382
let me = GetCurrentProcess();
@@ -162,7 +161,7 @@ where
162161

163162
#[cfg(any(unix, target_os = "redox"))]
164163
fn home_dir_() -> Option<PathBuf> {
165-
std::env::home_dir()
164+
env::home_dir()
166165
}
167166

168167
/// Returns the storage directory used by Cargo, often knowns as
@@ -217,7 +216,7 @@ pub fn cargo_home_with_cwd(cwd: &Path) -> io::Result<PathBuf> {
217216
let user_home = home_dir.map(|p| p.join(".cargo"));
218217

219218
// Compatibility with old cargo that used the std definition of home_dir
220-
let compat_home_dir = std::env::home_dir();
219+
let compat_home_dir = env::home_dir();
221220
let compat_user_home = compat_home_dir.map(|p| p.join(".cargo"));
222221

223222
if let Some(p) = env_cargo_home {

0 commit comments

Comments
 (0)