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

Document that parentheses are required for chained comparison operators (RFC 0). #41

Merged
merged 2 commits into from
Apr 17, 2017
Merged

Document that parentheses are required for chained comparison operators (RFC 0). #41

merged 2 commits into from
Apr 17, 2017

Conversation

ekse
Copy link
Contributor

@ekse ekse commented Apr 17, 2017

No description provided.

@ekse ekse mentioned this pull request Apr 17, 2017
48 tasks
@ekse
Copy link
Contributor Author

ekse commented Apr 17, 2017

This is my first attempt at a contribution to Rust (yay!), let me know if something is wrong or if you would like the text worded differently.

@@ -436,6 +436,9 @@ operators on standard types is given here.
: Greater than or equal.
Calls the `ge` method on the `std::cmp::PartialOrd` trait.

Parentheses are required when chaining comparison operators. For example, the
expression `a == b == c` is invalid and may be written as `((a == b) == c)`.
Copy link
Member

Choose a reason for hiding this comment

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

could this be (a == b) == c, that is, without the outer parens? In if statements, those outer ones will cause a warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, it's fixed now.

@steveklabnik
Copy link
Member

One tiny comment, otherwise, this looks good! Thank you! 😄

@steveklabnik steveklabnik merged commit c6f4de7 into rust-lang:master Apr 17, 2017
@steveklabnik
Copy link
Member

Thank you!

@ekse ekse deleted the parentheses-chained-comparisons branch April 17, 2017 16:14
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.

2 participants