mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 21:29:18 +00:00
fix #1267
This commit is contained in:
parent
97e3c419aa
commit
e848118c3c
@ -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(())
|
||||
}
|
||||
|
||||
@ -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<bool, ()> {
|
||||
pub fn compile_only(exercise: &Exercise) -> Result<bool, ()> {
|
||||
let progress_bar = ProgressBar::new_spinner();
|
||||
progress_bar.set_message(format!("Compiling {exercise}..."));
|
||||
progress_bar.enable_steady_tick(100);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user