Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit f6a439b

Browse files
committed
Beautify proc_arg
1 parent a763e65 commit f6a439b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/build/plan.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,10 @@ crate struct JobQueue(Vec<ProcessBuilder>);
481481

482482
fn proc_arg<T: AsRef<OsStr>>(prc: &ProcessBuilder, key: T) -> Option<&std::ffi::OsStr> {
483483
let args = prc.get_args();
484-
args.iter().enumerate()
485-
.find(|(_, arg)| arg.as_os_str() == key.as_ref())
486-
.map(|(idx, _)| idx + 1)
487-
.and_then(|idx| args.get(idx))
488-
.map(|x| x.as_os_str())
484+
let (idx, _) = args.iter().enumerate()
485+
.find(|(_, arg)| arg.as_os_str() == key.as_ref())?;
486+
487+
Some(args.get(idx + 1)?.as_os_str())
489488
}
490489

491490
impl fmt::Debug for JobQueue {

0 commit comments

Comments
 (0)