Skip to content

Commit

Permalink
apply new clippy rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Tao Guo committed Oct 16, 2023
1 parent 739946e commit e21e312
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 5 additions & 6 deletions src/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ impl CmdChildren {

fn wait_children(children: &mut Vec<Result<CmdChild>>) -> CmdResult {
let mut ret = Ok(());
while !children.is_empty() {
let child_handle = children.pop().unwrap();
while let Some(child_handle) = children.pop() {
match child_handle {
Err(e) => ret = Err(e),
Ok(child_handle) => {
Expand Down Expand Up @@ -122,7 +121,7 @@ impl FunChildren {
f(Box::new(stdout));
}
}
CmdChildHandle::SyncFn(_) => {
CmdChildHandle::SyncFn => {
if let Some(stdout) = child.stdout {
f(Box::new(stdout));
}
Expand Down Expand Up @@ -192,7 +191,7 @@ impl CmdChild {
pub(crate) enum CmdChildHandle {
Proc(Child),
Thread(JoinHandle<CmdResult>),
SyncFn(()),
SyncFn,
}

impl CmdChildHandle {
Expand Down Expand Up @@ -229,7 +228,7 @@ impl CmdChildHandle {
}
}
}
CmdChildHandle::SyncFn(_) => {}
CmdChildHandle::SyncFn => {}
}
drop(polling_stderr);
Ok(())
Expand Down Expand Up @@ -273,7 +272,7 @@ impl StderrLogging {
let thread = std::thread::spawn(move || {
BufReader::new(stderr)
.lines()
.filter_map(|line| line.ok())
.map_while(Result::ok)
.for_each(|line| info!("{}", line))
});
Self {
Expand Down
8 changes: 4 additions & 4 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ impl Cmd {
fn spawn(mut self, current_dir: &mut PathBuf, with_output: bool) -> Result<CmdChild> {
let arg0 = self.arg0();
if arg0 == CD_CMD {
let child = self.run_cd_cmd(current_dir)?;
self.run_cd_cmd(current_dir)?;
Ok(CmdChild::new(
CmdChildHandle::SyncFn(child),
CmdChildHandle::SyncFn,
self.cmd_str(),
self.stdout_logging,
self.stderr_logging,
Expand Down Expand Up @@ -416,9 +416,9 @@ impl Cmd {
self.stderr_logging,
))
} else {
let child = internal_cmd(&mut env)?;
internal_cmd(&mut env)?;
Ok(CmdChild::new(
CmdChildHandle::SyncFn(child),
CmdChildHandle::SyncFn,
cmd_str,
self.stdout_logging,
self.stderr_logging,
Expand Down

0 comments on commit e21e312

Please sign in to comment.