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

Add partial_min/max to libcore/cmp #17482

Merged
merged 1 commit into from
Sep 25, 2014
Merged

Add partial_min/max to libcore/cmp #17482

merged 1 commit into from
Sep 25, 2014

Conversation

tilpner
Copy link
Contributor

@tilpner tilpner commented Sep 23, 2014

Intended to prevent each user to write his own partial_min/max, possibly differing in slight details. @sfackler encouraged to PR this on IRC.

(Let's hope this works... First PR.)

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

@aturon
Copy link
Member

aturon commented Sep 23, 2014

cc @alexcrichton

match v1.partial_cmp(&v2) {
Some(Less) | Some(Equal) => Some(v1),
Some(Greater) => Some(v2),
_ => ::option::None
Copy link
Member

Choose a reason for hiding this comment

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

Could you explicitly match None here and return just None as well? (the ::option:: shouldn't be necessary)

@alexcrichton
Copy link
Member

Previous discussion can be seen here: #16067, but the summary is that this was the conclusion about the best way to go about this if we were to go about this. I'm personally ok with adding these as freestanding functions.

Given what we have today, these make sense, and if they're introduced as #[experimental] we can remove them if we decide to restructure later on.

}

for &(a, b, result) in data_float.iter() {
assert!(partial_min(a, b) == result);
Copy link
Contributor

Choose a reason for hiding this comment

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

minor whitespace issue

@tilpner
Copy link
Contributor Author

tilpner commented Sep 23, 2014

@thestinger I'm sorry, I don't see the problem. Is it about indentation or trailing whitespace?

Edit: Fixed that.

@tilpner
Copy link
Contributor Author

tilpner commented Sep 24, 2014

@alexcrichton Apparently, bors wasn't convinced, but, reading two logs, I can't determine what exactly caused it to fail and if it is my 'fault'. It doesn't have to do with my rebase, right?

@alexcrichton
Copy link
Member

The bit near the bottom has the culprit:

/Users/rustbuild/src/rust-buildbot/slave/auto-mac-32-opt/build/src/libcore/cmp.rs:272: trailing whitespace

@tilpner
Copy link
Contributor Author

tilpner commented Sep 25, 2014

Oh, I read that as a warning. Are there any other non-obvious things it refuses to merge?

Add partial_min/max to libcore/cmp

Match against None and mark as experimental

Shortened documentation.

Removed whitespace
bors added a commit that referenced this pull request Sep 25, 2014
Intended to prevent each user to write his own partial_min/max, possibly differing in slight details. @sfackler encouraged to PR this on IRC.

(Let's hope this works... First PR.)
@bors bors closed this Sep 25, 2014
@bors bors merged commit 29c2d3d into rust-lang:master Sep 25, 2014
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.

6 participants