Fix some comments by Clippy
This commit is contained in:
@@ -12,12 +12,13 @@ pub enum Executor {
|
|||||||
|
|
||||||
impl Executor {
|
impl Executor {
|
||||||
pub fn new<S: AsRef<OsStr>>(program: S, dry: bool) -> Self {
|
pub fn new<S: AsRef<OsStr>>(program: S, dry: bool) -> Self {
|
||||||
match dry {
|
if dry {
|
||||||
false => Executor::Wet(Command::new(program)),
|
Executor::Dry(DryCommand {
|
||||||
true => Executor::Dry(DryCommand {
|
|
||||||
program: program.as_ref().into(),
|
program: program.as_ref().into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
})
|
||||||
|
} else {
|
||||||
|
Executor::Wet(Command::new(program))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ impl Executor {
|
|||||||
|
|
||||||
pub fn spawn(&mut self) -> Result<ExecutorChild, io::Error> {
|
pub fn spawn(&mut self) -> Result<ExecutorChild, io::Error> {
|
||||||
match self {
|
match self {
|
||||||
Executor::Wet(c) => c.spawn().map(|c| ExecutorChild::Wet(c)),
|
Executor::Wet(c) => c.spawn().map(ExecutorChild::Wet),
|
||||||
Executor::Dry(c) => {
|
Executor::Dry(c) => {
|
||||||
print!(
|
print!(
|
||||||
"Dry running: {} {}",
|
"Dry running: {} {}",
|
||||||
@@ -100,7 +101,7 @@ pub enum ExecutorChild {
|
|||||||
impl ExecutorChild {
|
impl ExecutorChild {
|
||||||
pub fn wait(&mut self) -> Result<ExecutorExitStatus, io::Error> {
|
pub fn wait(&mut self) -> Result<ExecutorExitStatus, io::Error> {
|
||||||
match self {
|
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),
|
ExecutorChild::Dry => Ok(ExecutorExitStatus::Dry),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ impl Terminal {
|
|||||||
if self.width.is_none() {
|
if self.width.is_none() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
println!("");
|
println!();
|
||||||
loop {
|
loop {
|
||||||
let mut result = String::new();
|
let mut result = String::new();
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ impl Terminal {
|
|||||||
let _ = self.stdout.reset();
|
let _ = self.stdout.reset();
|
||||||
let _ = self.stdout.flush();
|
let _ = self.stdout.flush();
|
||||||
|
|
||||||
if let Ok(_) = stdin().read_line(&mut result) {
|
if stdin().read_line(&mut result).is_ok() {
|
||||||
match result.as_str() {
|
match result.as_str() {
|
||||||
"y\n" | "Y\n" => return true,
|
"y\n" | "Y\n" => return true,
|
||||||
"n\n" | "N\n" | "\n" => return false,
|
"n\n" | "N\n" | "\n" => return false,
|
||||||
|
|||||||
Reference in New Issue
Block a user