Skip to content

Commit

Permalink
Make Clippy happy
Browse files Browse the repository at this point in the history
Some linter-suggested fixes.
  • Loading branch information
unflxw committed Nov 14, 2024
1 parent 9f6009b commit 33a7837
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl ErrorConfig {
.post(url)
.query(&[("api_key", &self.api_key)])
.header("Content-Type", "application/json")
.body(ErrorBody::from_config(&self, timestamp, exit, lines))
.body(ErrorBody::from_config(self, timestamp, exit, lines))
.build()
}
}
Expand Down
30 changes: 13 additions & 17 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@ async fn start(cli: Cli) -> Result<i32, Box<dyn std::error::Error>> {
cron.request(&mut SystemTimestamp, CronKind::Finish),
));
}
} else {
if let Some(error) = error {
tasks.spawn(send_error_request(
error,
exit_status.clone(),
error_message.unwrap(),
));
}
} else if let Some(error) = error {
tasks.spawn(send_error_request(
error,
exit_status,
error_message.unwrap(),
));
}

if let Some(heartbeat) = heartbeat {
Expand Down Expand Up @@ -168,14 +166,13 @@ async fn start(cli: Cli) -> Result<i32, Box<dyn std::error::Error>> {
}
}

fn spawn_child(
cli: &Cli,
tasks: &TaskTracker,
) -> io::Result<(
type SpawnedChild = (
Child,
Option<UnboundedReceiver<String>>,
Option<UnboundedReceiver<String>>,
)> {
);

fn spawn_child(cli: &Cli, tasks: &TaskTracker) -> io::Result<SpawnedChild> {
let should_stdout = cli.should_pipe_stdout();
let should_stderr = cli.should_pipe_stderr();

Expand Down Expand Up @@ -381,10 +378,9 @@ async fn error_message_loop(
}
}

match sender.send(lines.into()) {
Err(_) => debug!("error sending error message"),
_ => (),
};
if sender.send(lines).is_err() {
debug!("error sending error message");
}
}

async fn forward_signals_and_wait(mut child: Child) -> io::Result<ExitStatus> {
Expand Down

0 comments on commit 33a7837

Please sign in to comment.