Skip to content

Commit 3962b56

Browse files
committed
more consistent error capitalization
1 parent f330035 commit 3962b56

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

cargo-miri/bin.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ impl CrateRunInfo {
5858

5959
fn store(&self, filename: &Path) {
6060
let file = File::create(filename)
61-
.unwrap_or_else(|_| show_error(format!("Cannot create `{}`", filename.display())));
61+
.unwrap_or_else(|_| show_error(format!("cannot create `{}`", filename.display())));
6262
let file = BufWriter::new(file);
6363
serde_json::ser::to_writer(file, self)
64-
.unwrap_or_else(|_| show_error(format!("Cannot write to `{}`", filename.display())));
64+
.unwrap_or_else(|_| show_error(format!("cannot write to `{}`", filename.display())));
6565
}
6666
}
6767

@@ -204,15 +204,15 @@ fn ask_to_run(mut cmd: Command, ask: bool, text: &str) {
204204
match buf.trim().to_lowercase().as_ref() {
205205
// Proceed.
206206
"" | "y" | "yes" => {}
207-
"n" | "no" => show_error(format!("Aborting as per your request")),
208-
a => show_error(format!("I do not understand `{}`", a)),
207+
"n" | "no" => show_error(format!("aborting as per your request")),
208+
a => show_error(format!("invalid answer `{}`", a)),
209209
};
210210
} else {
211211
println!("Running `{:?}` to {}.", cmd, text);
212212
}
213213

214214
if cmd.status().expect(&format!("failed to execute {:?}", cmd)).success().not() {
215-
show_error(format!("Failed to {}", text));
215+
show_error(format!("failed to {}", text));
216216
}
217217
}
218218

@@ -235,7 +235,7 @@ fn setup(subcommand: MiriCommand) {
235235
if xargo_version().map_or(true, |v| v < XARGO_MIN_VERSION) {
236236
if std::env::var_os("XARGO_CHECK").is_some() {
237237
// The user manually gave us a xargo binary; don't do anything automatically.
238-
show_error(format!("Your xargo is too old; please upgrade to the latest version"))
238+
show_error(format!("xargo is too old; please upgrade to the latest version"))
239239
}
240240
let mut cmd = cargo();
241241
cmd.args(&["install", "xargo", "-f"]);
@@ -275,7 +275,7 @@ fn setup(subcommand: MiriCommand) {
275275
}
276276
};
277277
if !rust_src.exists() {
278-
show_error(format!("Given Rust source directory `{}` does not exist.", rust_src.display()));
278+
show_error(format!("given Rust source directory `{}` does not exist.", rust_src.display()));
279279
}
280280

281281
// Next, we need our own libstd. Prepare a xargo project for that purpose.
@@ -349,7 +349,7 @@ path = "lib.rs"
349349
command.env_remove("RUSTFLAGS");
350350
// Finally run it!
351351
if command.status().expect("failed to run xargo").success().not() {
352-
show_error(format!("Failed to run xargo"));
352+
show_error(format!("failed to run xargo"));
353353
}
354354

355355
// That should be it! But we need to figure out where xargo built stuff.
@@ -575,7 +575,7 @@ fn phase_cargo_rustc(args: env::Args) {
575575

576576
// Use our custom sysroot.
577577
let sysroot =
578-
env::var_os("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
578+
env::var_os("MIRI_SYSROOT").expect("the wrapper should have set MIRI_SYSROOT");
579579
cmd.arg("--sysroot");
580580
cmd.arg(sysroot);
581581
} else {
@@ -597,20 +597,20 @@ fn phase_cargo_rustc(args: env::Args) {
597597
if emit_link_hack {
598598
// Some platforms prepend "lib", some do not... let's just create both files.
599599
let filename = out_filename("lib", ".rlib");
600-
File::create(filename).expect("Failed to create rlib file");
600+
File::create(filename).expect("failed to create rlib file");
601601
let filename = out_filename("", ".rlib");
602-
File::create(filename).expect("Failed to create rlib file");
602+
File::create(filename).expect("failed to create rlib file");
603603
}
604604
}
605605

606606
fn phase_cargo_runner(binary: &Path, binary_args: env::Args) {
607607
let verbose = std::env::var_os("MIRI_VERBOSE").is_some();
608608

609609
let file = File::open(&binary)
610-
.unwrap_or_else(|_| show_error(format!("File {:?} not found or `cargo-miri` invoked incorrectly; please only invoke this binary through `cargo miri`", binary)));
610+
.unwrap_or_else(|_| show_error(format!("file {:?} not found or `cargo-miri` invoked incorrectly; please only invoke this binary through `cargo miri`", binary)));
611611
let file = BufReader::new(file);
612612
let info: CrateRunInfo = serde_json::from_reader(file)
613-
.unwrap_or_else(|_| show_error(format!("File {:?} does not contain valid JSON", binary)));
613+
.unwrap_or_else(|_| show_error(format!("file {:?} contains outdated or invalid JSON; try `cargo clean`", binary)));
614614

615615
// Set missing env vars. Looks like `build.rs` vars are still set at run-time, but
616616
// `CARGO_BIN_EXE_*` are not. This means we can give the run-time environment precedence,
@@ -654,7 +654,7 @@ fn phase_cargo_runner(binary: &Path, binary_args: env::Args) {
654654
}
655655
// Set sysroot.
656656
let sysroot =
657-
env::var_os("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
657+
env::var_os("MIRI_SYSROOT").expect("the wrapper should have set MIRI_SYSROOT");
658658
cmd.arg("--sysroot");
659659
cmd.arg(sysroot);
660660
// Respect `MIRIFLAGS`.

0 commit comments

Comments
 (0)