Skip to content

Commit f7612f7

Browse files
committed
more consistent error capitalization
1 parent 192b535 commit f7612f7

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

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

217217
if cmd.status().expect(&format!("failed to execute {:?}", cmd)).success().not() {
218-
show_error(format!("Failed to {}", text));
218+
show_error(format!("failed to {}", text));
219219
}
220220
}
221221

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

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

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

579579
// Use our custom sysroot.
580580
let sysroot =
581-
env::var_os("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
581+
env::var_os("MIRI_SYSROOT").expect("the wrapper should have set MIRI_SYSROOT");
582582
cmd.arg("--sysroot");
583583
cmd.arg(sysroot);
584584
} else {
@@ -600,20 +600,20 @@ fn phase_cargo_rustc(args: env::Args) {
600600
if emit_link_hack {
601601
// Some platforms prepend "lib", some do not... let's just create both files.
602602
let filename = out_filename("lib", ".rlib");
603-
File::create(filename).expect("Failed to create rlib file");
603+
File::create(filename).expect("failed to create rlib file");
604604
let filename = out_filename("", ".rlib");
605-
File::create(filename).expect("Failed to create rlib file");
605+
File::create(filename).expect("failed to create rlib file");
606606
}
607607
}
608608

609609
fn phase_cargo_runner(binary: &Path, binary_args: env::Args) {
610610
let verbose = std::env::var_os("MIRI_VERBOSE").is_some();
611611

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

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

0 commit comments

Comments
 (0)