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

@ekseekse commented Apr 17, 2017

Copy link
Copy Markdown
Contributor

No description provided.

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

ekse commented Apr 17, 2017

Copy link
Copy Markdown
ContributorAuthor

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 threadsrc/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
ContributorAuthor

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:masterApr 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 freeto 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

@ekse@steveklabnik