Skip to content

Commit 97da63e

Browse files
committed
refactor: extract --jobserver-auth= to a free function
1 parent d357534 commit 97da63e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,7 @@ impl Client {
279279
}
280280
};
281281

282-
let (arg, pos) = match ["--jobserver-fds=", "--jobserver-auth="]
283-
.iter()
284-
.map(|&arg| var.find(arg).map(|pos| (arg, pos)))
285-
.find_map(|pos| pos)
286-
{
282+
let (arg, pos) = match find_jobserver_auth(var) {
287283
Some((arg, pos)) => (arg, pos),
288284
None => return FromEnv::new_err(FromEnvErrorInner::NoJobserver, env, var_os),
289285
};
@@ -588,6 +584,13 @@ impl HelperState {
588584
}
589585
}
590586

587+
fn find_jobserver_auth(var: &str) -> Option<(&str, usize)> {
588+
["--jobserver-fds=", "--jobserver-auth="]
589+
.iter()
590+
.map(|&arg| var.find(arg).map(|pos| (arg, pos)))
591+
.find_map(|pos| pos)
592+
}
593+
591594
#[test]
592595
fn no_helper_deadlock() {
593596
let x = crate::Client::new(32).unwrap();

0 commit comments

Comments
 (0)