Skip to content

Commit 768b565

Browse files
committed
Don't print "run the command again with --verbose"
Here is a typical error seen by users of Cargo: ``` error[E0601]: `main` function not found in crate `wrong` | = note: consider adding a `main` function to `src/main.rs` error: aborting due to previous error For more information about this error, try `rustc --explain E0601`. error: could not compile `wrong` To learn more, run the command again with --verbose. ``` The `--verbose` output is not particularly helpful in this case. The error is unrelated to what cargo is doing, and passing `--verbose` will not give useful information about how to proceed. Additionally, it's unclear that `--verbose` is referring to the cargo command and not rustc; this is especially true when cargo is wrapped by another build system (such as Meson, x.py, or Make). This omits the "run the command again with --verbose" output. --verbose is still shown in `cargo build --help`, but it's not singled out above all the other options.
1 parent 3ebb5f1 commit 768b565

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/cargo/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,7 @@ pub fn exit_with_error(err: CliError, shell: &mut Shell) -> ! {
8989
/// Displays an error, and all its causes, to stderr.
9090
pub fn display_error(err: &Error, shell: &mut Shell) {
9191
debug!("display_error; err={:?}", err);
92-
let has_verbose = _display_error(err, shell, true);
93-
if has_verbose {
94-
drop(writeln!(
95-
shell.err(),
96-
"\nTo learn more, run the command again with --verbose."
97-
));
98-
}
92+
_display_error(err, shell, true);
9993
if err
10094
.chain()
10195
.any(|e| e.downcast_ref::<InternalError>().is_some())

0 commit comments

Comments
 (0)