summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohan Jain <crodjer@gmail.com>2020-04-08 10:00:29 +0530
committerRoberto Vidal <vidal.roberto.j@gmail.com>2020-04-11 08:58:23 +0200
commit3ab084a421c0f140ae83bf1fc3f47b39342e7373 (patch)
tree5ec719e78977e2f7e0836a1ea58d210094c42bc1
parent495174ff7cb8782b25a4c67cb4d7a966ef468b83 (diff)
fix(run): compile clippy exercise files
Additionally to running clippy, also compile the exercise file so that `rustling run clippy1` works after a successful completion of the exercise. closes #291 Signed-off-by: Rohan Jain <crodjer@gmail.com>
-rw-r--r--src/exercise.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/exercise.rs b/src/exercise.rs
index 30b1864..d1eaa1a 100644
--- a/src/exercise.rs
+++ b/src/exercise.rs
@@ -98,6 +98,15 @@ path = "{}.rs""#,
);
fs::write(CLIPPY_CARGO_TOML_PATH, cargo_toml)
.expect("Failed to write 📎 Clippy 📎 Cargo.toml file.");
+ // To support the ability to run the clipy exercises, build
+ // an executable, in addition to running clippy. With a
+ // compilation failure, this would silently fail. But we expect
+ // clippy to reflect the same failure while compiling later.
+ Command::new("rustc")
+ .args(&[self.path.to_str().unwrap(), "-o", &temp_file()])
+ .args(RUSTC_COLOR_ARGS)
+ .output()
+ .expect("Failed to compile!");
// Due to an issue with Clippy, a cargo clean is required to catch all lints.
// See https://github.com/rust-lang/rust-clippy/issues/2604
// This is already fixed on master branch. See this issue to track merging into Cargo: