Unnamed repository; edit this file 'description' to name the repository.
Merge #11345
11345: minor: fix a typo in the style guide r=Veykril a=WaffleLapkin An example of preferring `<`/`<=` over `>`/`>=` was using `>`. Co-authored-by: Waffle Maybe <[email protected]>
bors[bot] 2022-01-26
parent 2cb85c1 · parent 6ab66d4 · commit 1f0c20e
-rw-r--r--docs/dev/style.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md
index e11005c560..d64c050ccd 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -927,13 +927,13 @@ When doing multiple comparisons use `<`/`<=`, avoid `>`/`>=`.
assert!(lo <= x && x <= hi);
assert!(r1 < l2 || r2 < l1);
assert!(x < y);
-assert!(x > 0);
+assert!(0 < x);
// BAD
assert!(x >= lo && x <= hi);
assert!(r1 < l2 || l1 > r2);
assert!(y > x);
-assert!(0 > x);
+assert!(x > 0);
```
**Rationale:** Less-then comparisons are more intuitive, they correspond spatially to [real line](https://en.wikipedia.org/wiki/Real_line).