From cc3ce0007d734c186111c5f451940ba0ce6b5fe3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 8 Mar 2018 23:24:27 +0300 Subject: [PATCH] Fix `--explain` --- src/bin/cli/mod.rs | 6 ++++++ tests/testsuite/cargo_command.rs | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bin/cli/mod.rs b/src/bin/cli/mod.rs index bd1585358..078ec624a 100644 --- a/src/bin/cli/mod.rs +++ b/src/bin/cli/mod.rs @@ -49,6 +49,12 @@ pub fn do_main(config: &mut Config) -> CliResult { return Ok(()); } + if let Some(ref code) = args.value_of("explain") { + let mut procss = config.rustc()?.process(); + procss.arg("--explain").arg(code).exec()?; + return Ok(()); + } + if args.is_present("list") { println!("Installed Commands:"); for command in list_commands(config) { diff --git a/tests/testsuite/cargo_command.rs b/tests/testsuite/cargo_command.rs index 598f5a717..7944fbeed 100644 --- a/tests/testsuite/cargo_command.rs +++ b/tests/testsuite/cargo_command.rs @@ -214,5 +214,6 @@ fn cargo_help() { #[test] fn explain() { assert_that(cargo_process().arg("--explain").arg("E0001"), - execs().with_status(0)); + execs().with_status(0).with_stdout_contains("\ +This error suggests that the expression arm corresponding to the noted pattern")); } -- 2.30.2