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

Use libc_enum! where possible #792

Merged
merged 2 commits into from
Nov 11, 2017
Merged

Use libc_enum! where possible #792

merged 2 commits into from
Nov 11, 2017

Conversation

wginolas
Copy link
Contributor

@wginolas wginolas commented Nov 5, 2017

Some enums which use different names for values than libc still set the
discriminators manually.

closes #254

@wginolas
Copy link
Contributor Author

wginolas commented Nov 5, 2017

My editor used rustfmt, so this change is bigger than necessary. Should I undo the stuff rustfmt changed?

@Susurrus
Copy link
Contributor

Susurrus commented Nov 5, 2017

There's no problem with those changes being the PR, though I don't agree with all of the changes. In general when contributing PRs, however, you should separate changes into multiple commits to make it easier to review. In this case, I'd suggest one commit for the functional code changes and one commit for all the remaining style changes.

@wginolas
Copy link
Contributor Author

wginolas commented Nov 5, 2017

OK, I removed the formatting changes for now.

Copy link
Contributor

@Susurrus Susurrus left a comment

Choose a reason for hiding this comment

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

This will need to be rebases once #790 is merged also, but otherwise this does greatly improve all this code, thanks!

src/sys/aio.rs Outdated
/// do it like `fsync`
O_SYNC,
/// on supported operating systems only, do it like `fdatasync`
#[cfg(any(target_os = "openbsd", target_os = "bitrig",
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're touching these lines I'd ask that you also alphabetize the target OSes and when they're longer than a line and need to be wrapped that you wrap them such that there's 1 OS per line. This applies across this whole PR.

@Susurrus
Copy link
Contributor

Susurrus commented Nov 5, 2017

You'll need to rebase now that #790 was merged.

Some enums which use different names for values than libc still set the
discriminators manually.

closes nix-rust#254
src/sys/aio.rs Outdated
#[cfg(any(target_os = "openbsd", target_os = "bitrig",
target_os = "netbsd", target_os = "macos", target_os = "ios",
target_os = "linux"))]
#[cfg(any(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you put the first target OS on the same line as #[cfg(any(? This is consistent with our styling elsewhere.

@wginolas
Copy link
Contributor Author

wginolas commented Nov 7, 2017

OK, I will try to take care of this in ~10 hours.

@Susurrus
Copy link
Contributor

Susurrus commented Nov 8, 2017

Please squash your last two commits into one as they're both part of the same change. I believe the test failures on Darwin targets were changes in Cross that have since been resolved, but I'm testing now. So with those things fixed, we can merge this.

@Susurrus
Copy link
Contributor

Susurrus commented Nov 9, 2017

@wginolas Just needs those last 2 commits squashed and then this can be merged!

@Susurrus
Copy link
Contributor

bors r+

bors bot added a commit that referenced this pull request Nov 11, 2017
792: Use libc_enum! where possible r=Susurrus a=wginolas

Some enums which use different names for values than libc still set the
discriminators manually.

closes #254
@bors
Copy link
Contributor

bors bot commented Nov 11, 2017

@bors bors bot merged commit 7e28016 into nix-rust:master Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use enums for enumeration constants
2 participants