mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 00:00:03 +03:00
Use PartialEq instead of matches!
This commit is contained in:
parent
d2b5906be2
commit
8b2d9ed503
|
@ -13,6 +13,7 @@ use crate::{
|
||||||
terminal_link::TerminalFileLink,
|
terminal_link::TerminalFileLink,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(PartialEq, Eq)]
|
||||||
enum DoneStatus {
|
enum DoneStatus {
|
||||||
DoneWithSolution(String),
|
DoneWithSolution(String),
|
||||||
DoneWithoutSolution,
|
DoneWithoutSolution,
|
||||||
|
@ -77,7 +78,7 @@ impl<'a> WatchState<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_exercise(&mut self) -> Result<ExercisesProgress> {
|
pub fn next_exercise(&mut self) -> Result<ExercisesProgress> {
|
||||||
if matches!(self.done_status, DoneStatus::Pending) {
|
if self.done_status == DoneStatus::Pending {
|
||||||
return Ok(ExercisesProgress::CurrentPending);
|
return Ok(ExercisesProgress::CurrentPending);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ impl<'a> WatchState<'a> {
|
||||||
write!(self.writer, "{}un/", 'r'.bold())?;
|
write!(self.writer, "{}un/", 'r'.bold())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !matches!(self.done_status, DoneStatus::Pending) {
|
if self.done_status != DoneStatus::Pending {
|
||||||
write!(self.writer, "{}ext/", 'n'.bold())?;
|
write!(self.writer, "{}ext/", 'n'.bold())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ impl<'a> WatchState<'a> {
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !matches!(self.done_status, DoneStatus::Pending) {
|
if self.done_status != DoneStatus::Pending {
|
||||||
writeln!(
|
writeln!(
|
||||||
self.writer,
|
self.writer,
|
||||||
"{}\n",
|
"{}\n",
|
||||||
|
|
Loading…
Reference in a new issue