summaryrefslogtreecommitdiff
path: root/src/exercise.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-03-27 15:00:57 +0100
committermo8it <mo8it@proton.me>2024-03-27 15:00:57 +0100
commita27741b131a434a2af5884eb9690b2200a3f21e7 (patch)
tree61ced2dab1431e8cc7218cf9fb8e5f0abfa31a80 /src/exercise.rs
parent078f6ffc1cf18546079d03bee99f0903c9e14703 (diff)
parentb13bafa13e461f1a2f1f0b56adfb03e0519a8517 (diff)
Merge branch 'main' into performance
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 cdf8d20..19f528a 100644
--- a/src/exercise.rs
+++ b/src/exercise.rs
@@ -3,7 +3,7 @@ use std::fmt::{self, Display, Formatter};
use std::fs::{self, remove_file, File};
use std::io::{self, BufRead, BufReader};
use std::path::PathBuf;
-use std::process::{self, exit, Command};
+use std::process::{self, exit, Command, Stdio};
use std::{array, env, mem};
use winnow::ascii::{space0, Caseless};
use winnow::combinator::opt;
@@ -72,7 +72,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,
@@ -81,7 +81,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,
@@ -162,7 +162,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
@@ -171,7 +174,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])