Fomat and clippy

This commit is contained in:
Félix Saparelli 2021-05-10 23:37:03 +12:00
parent 319727b0a6
commit d8540d76b8
No known key found for this signature in database
GPG key ID: B948C4BAE44FC474
2 changed files with 12 additions and 6 deletions

View file

@ -13,5 +13,12 @@ fn help() {
assert!(output.status.success(), "--help returns 0"); assert!(output.status.success(), "--help returns 0");
assert_eq!(output.stderr, Vec::<u8>::new(), "--help stderr is empty"); assert_eq!(output.stderr, Vec::<u8>::new(), "--help stderr is empty");
assert_snapshot!(if cfg!(windows) { "help_windows" } else { "help_unix" }, String::from_utf8(output.stdout).unwrap()); assert_snapshot!(
if cfg!(windows) {
"help_windows"
} else {
"help_unix"
},
String::from_utf8(output.stdout).unwrap()
);
} }

View file

@ -370,19 +370,18 @@ mod imp {
command.env(name, val); command.env(name, val);
} }
command.spawn().and_then(|p| { command.spawn().map(|p| {
let handle = p.into_raw_handle(); let handle = p.into_raw_handle();
let r = unsafe { AssignProcessToJobObject(job, handle) }; if unsafe { AssignProcessToJobObject(job, handle) } == 0 {
if r == 0 {
panic!("failed to add to job object: {}", last_err()); panic!("failed to add to job object: {}", last_err());
} }
resume_threads(handle); resume_threads(handle);
Ok(Self { Self {
job, job,
completion_port, completion_port,
}) }
}) })
} }