Skip to content

Commit 745b0f5

Browse files
committed
fix: too many args by introducing a wrapper struct
1 parent d3c4aa1 commit 745b0f5

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

rewatch/src/watcher.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,28 @@ fn matches_filter(path_buf: &Path, filter: &Option<regex::Regex>) -> bool {
5555
filter.as_ref().map(|re| !re.is_match(&name)).unwrap_or(true)
5656
}
5757

58-
async fn async_watch(
58+
struct AsyncWatchArgs<'a> {
5959
q: Arc<FifoQueue<Result<Event, Error>>>,
60-
path: &Path,
60+
path: &'a Path,
6161
show_progress: bool,
62-
filter: &Option<regex::Regex>,
62+
filter: &'a Option<regex::Regex>,
6363
after_build: Option<String>,
6464
create_sourcedirs: bool,
6565
build_dev_deps: bool,
6666
snapshot_output: bool,
67+
}
68+
69+
async fn async_watch(
70+
AsyncWatchArgs {
71+
q,
72+
path,
73+
show_progress,
74+
filter,
75+
after_build,
76+
create_sourcedirs,
77+
build_dev_deps,
78+
snapshot_output,
79+
}: AsyncWatchArgs<'_>,
6780
) -> notify::Result<()> {
6881
let mut build_state =
6982
build::initialize_build(None, filter, show_progress, path, build_dev_deps, snapshot_output)
@@ -309,16 +322,16 @@ pub fn start(
309322

310323
let path = Path::new(folder);
311324

312-
if let Err(e) = async_watch(
313-
consumer,
325+
if let Err(e) = async_watch(AsyncWatchArgs {
326+
q: consumer,
314327
path,
315328
show_progress,
316329
filter,
317330
after_build,
318331
create_sourcedirs,
319332
build_dev_deps,
320333
snapshot_output,
321-
)
334+
})
322335
.await
323336
{
324337
println!("{e:?}")

0 commit comments

Comments
 (0)