Skip to content

Commit a2c4e05

Browse files
author
deniz
committed
clippy && fmt
1 parent 8df89f8 commit a2c4e05

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/hot_reload/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ impl<'a> DevSession<'a> {
128128

129129
#[allow(unused_assignments)]
130130
#[allow(clippy::too_many_lines)]
131+
#[allow(clippy::await_holding_lock)]
131132
async fn handle_commands(
132133
mut self,
133134
mut rx: mpsc::Receiver<Command>,

src/interop/hooks.rs

+17-15
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use console::style;
55
use indicatif::{ProgressBar, ProgressStyle};
66
use tokio::{io::AsyncBufReadExt, process::Command};
77

8-
use crate::{app::App, model::{HookEvent, HookFailBehavior}};
8+
use crate::{
9+
app::App,
10+
model::{HookEvent, HookFailBehavior},
11+
};
912

1013
pub struct HooksAPI<'a>(pub &'a App);
1114

@@ -45,7 +48,8 @@ impl<'a> HooksAPI<'a> {
4548
continue;
4649
}
4750

48-
let spinner = self.0
51+
let spinner = self
52+
.0
4953
.multi_progress
5054
.add(
5155
ProgressBar::new_spinner().with_style(ProgressStyle::with_template(
@@ -54,10 +58,11 @@ impl<'a> HooksAPI<'a> {
5458
);
5559

5660
spinner.enable_steady_tick(Duration::from_millis(200));
57-
spinner.set_prefix(format!(
58-
"Running hook {}",
59-
style(filename.clone()).blue()
60-
));
61+
spinner.set_prefix(format!("Running hook {}", style(filename.clone()).blue()));
62+
63+
if hook.show_output {
64+
self.0.log_dev(format!("Running {filename}"));
65+
}
6166

6267
let mut cmd = Command::new(path);
6368
cmd.kill_on_drop(true)
@@ -68,8 +73,7 @@ impl<'a> HooksAPI<'a> {
6873
cmd.env(k, v);
6974
}
7075

71-
let mut child = cmd.spawn()
72-
.context(format!("Spawning hook {filename}"))?;
76+
let mut child = cmd.spawn().context(format!("Spawning hook {filename}"))?;
7377

7478
let stdout = child.stdout.take().unwrap();
7579
let mut lines = tokio::io::BufReader::new(stdout).lines();
@@ -78,23 +82,21 @@ impl<'a> HooksAPI<'a> {
7882
spinner.set_message(line.clone());
7983
if hook.show_output {
8084
self.0.multi_progress.suspend(|| {
81-
println!(
82-
"{}{}",
83-
style("| ").bold(),
84-
line.trim()
85-
);
85+
println!("{}{}", style("| ").bold(), line.trim());
8686
});
8787
}
8888
}
8989

90-
let status = child.wait().await
90+
let status = child
91+
.wait()
92+
.await
9193
.context(format!("waiting hook {filename}"))?;
9294
spinner.finish_and_clear();
9395
if status.success() {
9496
self.0.success(format!("Hook {filename}"));
9597
} else {
9698
match hook.onfail {
97-
HookFailBehavior::Ignore => {},
99+
HookFailBehavior::Ignore => {}
98100
HookFailBehavior::Warn => self.0.warn(format!("Hook {filename} failed")),
99101
HookFailBehavior::Error => bail!("Hook {filename} failed"),
100102
}

0 commit comments

Comments
 (0)