From eb941165ccf6aa22db08016db4f8003a92f2ed41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Duquette?= Date: Sun, 16 Apr 2017 22:20:53 -0400 Subject: [PATCH 1/2] Document that parentheses are required for chained comparison operators (RFC 0000). --- src/expressions.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/expressions.md b/src/expressions.md index dbff080c221b4..ac6dd82fc724d 100644 --- a/src/expressions.md +++ b/src/expressions.md @@ -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)`. + ### Type cast expressions A type cast expression is denoted with the binary operator `as`. From 0a55590eaac98e1924638d35c02bf232060a6374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Duquette?= Date: Mon, 17 Apr 2017 11:56:23 -0400 Subject: [PATCH 2/2] Removed outer parentheses in the example. --- src/expressions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expressions.md b/src/expressions.md index ac6dd82fc724d..df79faba750b3 100644 --- a/src/expressions.md +++ b/src/expressions.md @@ -437,7 +437,7 @@ operators on standard types is given here. 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)`. +expression `a == b == c` is invalid and may be written as `(a == b) == c`. ### Type cast expressions