Skip to content

Commit

Permalink
Remove env::home_dir() usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm committed Aug 29, 2018
1 parent abe1ebb commit 2c24573
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 2 additions & 1 deletion cargo-cov/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-cov"
version = "0.0.4"
version = "0.0.5"
authors = ["kennytm <[email protected]>"]
description = "Collect source coverage via LLVM-GCOV (⚠ not fully tested, may eat your laundry)"
build = "build.rs"
Expand All @@ -27,6 +27,7 @@ error-chain = "0.12.0"
fs2 = "0.4"
fs_extra = "1"
glob = "0.2"
home = "0.3"
lazy_static = "1"
log = { version = "0.4", features = ["release_max_level_warn"] }
md5 = "0.3" # <- md5 needed for coveralls
Expand Down
1 change: 1 addition & 0 deletions cargo-cov/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ extern crate env_logger;
extern crate fs_extra;
extern crate fs2;
extern crate glob;
extern crate home;
extern crate md5;
extern crate natord;
extern crate open;
Expand Down
11 changes: 4 additions & 7 deletions cargo-cov/src/sourcepath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
use cov::IntoStringLossy;

use std::env;
use std::path::{MAIN_SEPARATOR, PathBuf};
use home::cargo_home;

use std::path::MAIN_SEPARATOR;
use std::str::FromStr;

/// Path to the hard-coded Rust source of libraries built by macOS builders on Travis CI.
Expand All @@ -26,11 +27,7 @@ lazy_static! {
///
/// The string should be equal to `$CARGO_HOME/registry/src` where `$CARGO_HOME` is `~/.cargo` by default.
static ref REGISTRY_PATH: String = {
let mut cargo_home = env::var_os("CARGO_HOME").map_or_else(|| {
let mut home = env::home_dir().unwrap_or_else(|| "/".into());
home.push(".cargo");
home
}, PathBuf::from);
let mut cargo_home = cargo_home().expect("$CARGO_HOME is undefined");
cargo_home.push("registry");
cargo_home.push("src");
let mut registry_path = cargo_home.into_string_lossy();
Expand Down
2 changes: 1 addition & 1 deletion cov/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cov"
version = "0.0.4"
version = "0.0.5"
authors = ["kennytm <[email protected]>"]
description = "gcov format (*.gcda/*.gcno) parser and analyzer in pure Rust"
documentation = "https://docs.rs/cov"
Expand Down

0 comments on commit 2c24573

Please sign in to comment.