Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 27, 2018
1 parent 58982d6 commit 07f78a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ required-features = ["rustc_tests"]
[dependencies]
byteorder = { version = "1.1", features = ["i128"]}
cargo_metadata = { version = "0.6", optional = true }
dirs = { version = "1.0.4", optional = true }
directories = { version = "1.0", optional = true }
env_logger = "0.5"
log = "0.4"

Expand All @@ -44,7 +44,7 @@ vergen = "3"

[features]
default = ["cargo_miri"]
cargo_miri = ["cargo_metadata", "dirs"]
cargo_miri = ["cargo_metadata", "directories"]
rustc_tests = []

[dev-dependencies]
Expand Down
16 changes: 5 additions & 11 deletions src/bin/cargo-miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ fn list_targets(mut args: impl Iterator<Item=String>) -> impl Iterator<Item=carg
{
metadata
} else {
let _ = std::io::stderr().write_fmt(format_args!(
"error: Could not obtain cargo metadata."
));
std::process::exit(101);
show_error(format!("error: Could not obtain cargo metadata."));
};

let manifest_path = manifest_path_arg.map(|arg| {
Expand Down Expand Up @@ -106,14 +103,11 @@ fn ask(question: &str) {
print!("{} [Y/n] ", question);
io::stdout().flush().unwrap();
io::stdin().read_line(&mut buf).unwrap();
let answer = match buf.trim().to_lowercase().as_ref() {
"" | "y" | "yes" => true,
"n" | "no" => false,
match buf.trim().to_lowercase().as_ref() {
"" | "y" | "yes" => {}, // proceed
"n" | "no" => show_error(format!("Aborting as per your request")),
a => show_error(format!("I do not understand `{}`", a))
};
if !answer {
show_error(format!("Aborting as per your request"))
}
}

/// Perform the setup requires to make `cargo miri` work: Getting a custom-built libstd. Then sets MIRI_SYSROOT.
Expand Down Expand Up @@ -152,7 +146,7 @@ fn setup(ask_user: bool) {
}

// Next, we need our own libstd. We will do this work in ~/.miri.
let dir = dirs::home_dir().unwrap().join(".miri");
let dir = directories::UserDirs::new().unwrap().home_dir().join(".miri");
if !dir.exists() {
fs::create_dir(&dir).unwrap();
}
Expand Down

0 comments on commit 07f78a3

Please sign in to comment.