summaryrefslogtreecommitdiff
path: root/src/exercise.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-03-27 14:30:10 +0100
committermo8it <mo8it@proton.me>2024-03-27 14:30:10 +0100
commitb9d2756ce8093adb1a2e5a2ddc45bd07f1322f42 (patch)
tree200b890941938bf930a344a97ff3a9cfdcc3be45 /src/exercise.rs
parente4520602f52935ff310534afc65160bcc5796a97 (diff)
parent07dec76f7c7f90d0768d2f5d9990e0b06019e0cd (diff)
Merge branch 'main' into toml
Diffstat (limited to 'src/exercise.rs')
-rw-r--r--src/exercise.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/exercise.rs b/src/exercise.rs
index 664b362..0a6513f 100644
--- a/src/exercise.rs
+++ b/src/exercise.rs
@@ -5,7 +5,7 @@ use std::fmt::{self, Display, Formatter};
use std::fs::{self, remove_file, File};
use std::io::Read;
use std::path::PathBuf;
-use std::process::{self, Command};
+use std::process::{self, Command, Stdio};
const RUSTC_COLOR_ARGS: &[&str] = &["--color", "always"];
const RUSTC_EDITION_ARGS: &[&str] = &["--edition", "2021"];
@@ -58,7 +58,7 @@ pub struct Exercise {
// An enum to track of the state of an Exercise.
// An Exercise can be either Done or Pending
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
pub enum State {
// The state of the exercise once it's been completed
Done,
@@ -67,7 +67,7 @@ pub enum State {
}
// The context information of a pending exercise
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
pub struct ContextLine {
// The source code that is still pending completion
pub line: String,
@@ -148,7 +148,10 @@ path = "{}.rs""#,
.args(RUSTC_COLOR_ARGS)
.args(RUSTC_EDITION_ARGS)
.args(RUSTC_NO_DEBUG_ARGS)
- .output()
+ .stdin(Stdio::null())
+ .stdout(Stdio::null())
+ .stderr(Stdio::null())
+ .status()
.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
@@ -157,7 +160,10 @@ path = "{}.rs""#,
Command::new("cargo")
.args(["clean", "--manifest-path", CLIPPY_CARGO_TOML_PATH])
.args(RUSTC_COLOR_ARGS)
- .output()
+ .stdin(Stdio::null())
+ .stdout(Stdio::null())
+ .stderr(Stdio::null())
+ .status()
.expect("Failed to run 'cargo clean'");
Command::new("cargo")
.args(["clippy", "--manifest-path", CLIPPY_CARGO_TOML_PATH])