Fix some comments by Clippy

This commit is contained in:
Roey Darwish Dror
2018-09-06 15:17:03 +03:00
parent 1c317f5332
commit 9f5d5a8b53
2 changed files with 9 additions and 8 deletions

View File

@@ -12,12 +12,13 @@ pub enum Executor {
impl Executor {
pub fn new<S: AsRef<OsStr>>(program: S, dry: bool) -> Self {
match dry {
false => Executor::Wet(Command::new(program)),
true => Executor::Dry(DryCommand {
if dry {
Executor::Dry(DryCommand {
program: program.as_ref().into(),
..Default::default()
}),
})
} else {
Executor::Wet(Command::new(program))
}
}
@@ -64,7 +65,7 @@ impl Executor {
pub fn spawn(&mut self) -> Result<ExecutorChild, io::Error> {
match self {
Executor::Wet(c) => c.spawn().map(|c| ExecutorChild::Wet(c)),
Executor::Wet(c) => c.spawn().map(ExecutorChild::Wet),
Executor::Dry(c) => {
print!(
"Dry running: {} {}",
@@ -100,7 +101,7 @@ pub enum ExecutorChild {
impl ExecutorChild {
pub fn wait(&mut self) -> Result<ExecutorExitStatus, io::Error> {
match self {
ExecutorChild::Wet(c) => c.wait().map(|s| ExecutorExitStatus::Wet(s)),
ExecutorChild::Wet(c) => c.wait().map(ExecutorExitStatus::Wet),
ExecutorChild::Dry => Ok(ExecutorExitStatus::Dry),
}
}

View File

@@ -71,7 +71,7 @@ impl Terminal {
if self.width.is_none() {
return false;
}
println!("");
println!();
loop {
let mut result = String::new();
@@ -82,7 +82,7 @@ impl Terminal {
let _ = self.stdout.reset();
let _ = self.stdout.flush();
if let Ok(_) = stdin().read_line(&mut result) {
if stdin().read_line(&mut result).is_ok() {
match result.as_str() {
"y\n" | "Y\n" => return true,
"n\n" | "N\n" | "\n" => return false,