Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove combine function #74356

Merged
merged 1 commit into from
Jul 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/libstd/sys/unix/process/process_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ impl Command {
Ok(0) => return Ok((p, ours)),
Ok(8) => {
let (errno, footer) = bytes.split_at(4);
assert!(
combine(CLOEXEC_MSG_FOOTER) == combine(footer.try_into().unwrap()),
assert_eq!(
CLOEXEC_MSG_FOOTER, footer,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rustfmt will dislike that. footer, should be in a newline.

Copy link
Contributor Author

@tesuji tesuji Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so. But rustfmt wants the current format.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow... that is very unexpected to me. Interesting.

"Validation on the CLOEXEC pipe failed: {:?}",
bytes
);
let errno = combine(errno.try_into().unwrap());
let errno = i32::from_be_bytes(errno.try_into().unwrap());
assert!(p.wait().is_ok(), "wait() should either return Ok or panic");
return Err(Error::from_raw_os_error(errno));
}
Expand All @@ -105,10 +105,6 @@ impl Command {
}
}
}

fn combine(arr: [u8; 4]) -> i32 {
i32::from_be_bytes(arr)
}
}

pub fn exec(&mut self, default: Stdio) -> io::Error {
Expand Down