From e848118c3c1f1a05fcadca6eac057ab9458bb4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E5=9D=A4?= Date: Mon, 14 Nov 2022 19:42:18 +0800 Subject: [PATCH] fix #1267 --- src/run.rs | 7 +++++-- src/verify.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/run.rs b/src/run.rs index 1e2e56cf..123b03c7 100644 --- a/src/run.rs +++ b/src/run.rs @@ -1,7 +1,7 @@ use std::process::Command; use crate::exercise::{Exercise, Mode}; -use crate::verify::test; +use crate::verify::{test, compile_only}; use indicatif::ProgressBar; // Invoke the rust compiler on the path of the given exercise, @@ -12,7 +12,10 @@ pub fn run(exercise: &Exercise, verbose: bool) -> Result<(), ()> { match exercise.mode { Mode::Test => test(exercise, verbose)?, Mode::Compile => compile_and_run(exercise)?, - Mode::Clippy => compile_and_run(exercise)?, + Mode::Clippy => match compile_only(exercise).unwrap() { + true => return Err(()), + false => return Ok(()), + }, } Ok(()) } diff --git a/src/verify.rs b/src/verify.rs index 97471b8f..6435bb18 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -48,7 +48,7 @@ pub fn test(exercise: &Exercise, verbose: bool) -> Result<(), ()> { } // Invoke the rust compiler without running the resulting binary -fn compile_only(exercise: &Exercise) -> Result { +pub fn compile_only(exercise: &Exercise) -> Result { let progress_bar = ProgressBar::new_spinner(); progress_bar.set_message(format!("Compiling {exercise}...")); progress_bar.enable_steady_tick(100);