Fix `--explain`
authorAleksey Kladov <aleksey.kladov@gmail.com>
Thu, 8 Mar 2018 20:24:27 +0000 (23:24 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Thu, 8 Mar 2018 20:31:56 +0000 (23:31 +0300)
src/bin/cli/mod.rs
tests/testsuite/cargo_command.rs

index bd15853582c6e463e5ad9f857f8e39cabc001341..078ec624a7255f94a18e9a9620c0b6f1d8946564 100644 (file)
@@ -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) {
index 598f5a717097b408e882ea0ec3bedd3aad74899c..7944fbeed0495725254301b82c4eeef485e909fb 100644 (file)
@@ -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"));
 }