Skip to content

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

Merged
steveklabnik merged 2 commits into
rust-lang:masterfrom
ekse:parentheses-chained-comparisons
Apr 17, 2017
Merged

Document that parentheses are required for chained comparison operators (RFC 0).#41
steveklabnik merged 2 commits into
rust-lang:masterfrom
ekse:parentheses-chained-comparisons

Conversation

@ekse

@ekse ekse commented Apr 17, 2017

Copy link
Copy Markdown
Contributor

No description provided.

@ekse ekse mentioned this pull request Apr 17, 2017
48 tasks
@ekse

ekse commented Apr 17, 2017

Copy link
Copy Markdown
Contributor Author

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.

Comment thread src/expressions.md Outdated
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Contributor

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

2 participants