refactor: map_or_else to map_or

This commit is contained in:
Jack Wills
2022-10-07 02:22:26 +00:00
parent 3e26f292c7
commit 5660b34d51
3 changed files with 18 additions and 17 deletions
+4 -4
View File
@@ -5,10 +5,10 @@ use std::fmt;
#[allow(unused)]
#[derive(Debug, Clone, Copy)]
pub enum AppError {
DockerCommand(DockerControls),
DockerConnect,
DockerInterval,
InputPoll,
DockerCommand(DockerControls),
MouseCapture(bool),
Terminal,
}
@@ -17,15 +17,15 @@ pub enum AppError {
impl fmt::Display for AppError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::DockerCommand(s) => write!(f, "Unable to {} container", s),
Self::DockerConnect => write!(f, "Unable to access docker daemon"),
Self::DockerInterval => write!(f, "Docker update interval needs to be greater than 0"),
Self::InputPoll => write!(f, "Unable to poll user input"),
Self::Terminal => write!(f, "Unable to draw to terminal"),
Self::DockerCommand(s) => write!(f, "Unable to {} container", s),
Self::MouseCapture(x) => {
let reason = if *x { "en" } else { "dis" };
let reason = if *x { "en" } else { "dis" };
write!(f, "Unbale to {}able mouse capture", reason)
}
Self::Terminal => write!(f, "Unable to draw to terminal"),
}
}
}