Skip to content

Update the version ordering algorithm to semver 2.0.0. #7726

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

Merged
merged 2 commits into from
Jul 16, 2013
Merged

Update the version ordering algorithm to semver 2.0.0. #7726

merged 2 commits into from
Jul 16, 2013

Conversation

omasanori
Copy link
Contributor

The Ord impl of Version refered to the algorithm in release candidate versions of semver. Semantic Versioning 2.0.0 says, "Build metadata SHOULD be ignored when determining version precedence."

Note that Version's le is not "less than or equal to" now, since lt ignores build metadata. I think the new ordering algorithm satisfies strict weak ordering which C++ STL requires, instead of strict total ordering.

BTW, is a || b || ... || x-style code better or idiomatic in Rust than if a { return true; } if b { return true; } ... if x { return true; } return false;-style one?

@emberian
Copy link
Member

@omasanori re: Ord, that's fine, we have a TotalOrd trait which is separate. Yes, a || b || ... code is usually better.

Can you add tests that ensure the build metadata is correctly ignored, rather than removing them altogether?

@omasanori
Copy link
Contributor Author

@cmr I see.

I've removed the tests because corresponding tests are removed in the spec, but I'll add them in tests for lt, le and so on.

Note that Version's `le` is not "less than or equal to" now, since `lt`
ignores build metadata. I think the new ordering algorithm satisfies
strict weak ordering which C++ STL requires, instead of strict total
ordering.
bors added a commit that referenced this pull request Jul 16, 2013
The Ord impl of Version refered to the algorithm in release candidate versions of semver. [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html) says, "Build metadata SHOULD be ignored when determining version precedence."

Note that Version's `le` is not "less than or equal to" now, since `lt` ignores build metadata. I think the new ordering algorithm satisfies strict weak ordering which C++ STL requires, instead of strict total ordering.

BTW, is `a || b || ... || x`-style code better or idiomatic in Rust than `if a { return true; } if b { return true; } ... if x { return true; } return false;`-style one?
@bors bors closed this Jul 16, 2013
@bors bors merged commit 31d29d3 into rust-lang:master Jul 16, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 4, 2021
…ip1995

Unseparated literal suffix

Closes rust-lang#7658

Since `literal_suffix` style is opinionated, we should disable by default and only enforce if it's stated as so.

changelog: [`unseparated_literal_suffix`] is renamed to `literal_suffix`, adds a new configuration `literal-suffix-style` to enforce a certain style writing literal_suffix. Possible values for `literal-suffix-style`: `"separated"`, `"unseparated"`
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.

3 participants