diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/style.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/dev/style.md b/docs/dev/style.md index 67cbc6744..9859f6148 100644 --- a/docs/dev/style.md +++ b/docs/dev/style.md | |||
@@ -78,6 +78,8 @@ Use original span for FileId | |||
78 | 78 | ||
79 | This makes it easier to prepare a changelog. | 79 | This makes it easier to prepare a changelog. |
80 | 80 | ||
81 | If the change adds a new user-visible functionality, consider recording a GIF with [peek](https://github.com/phw/peek) and pasting it into the PR description. | ||
82 | |||
81 | **Rationale:** clean history is potentially useful, but rarely used. | 83 | **Rationale:** clean history is potentially useful, but rarely used. |
82 | But many users read changelogs. | 84 | But many users read changelogs. |
83 | 85 | ||
@@ -643,6 +645,27 @@ assert!(x >= lo && x <= hi>); | |||
643 | **Rationale:** Less-then comparisons are more intuitive, they correspond spatially to [real line](https://en.wikipedia.org/wiki/Real_line). | 645 | **Rationale:** Less-then comparisons are more intuitive, they correspond spatially to [real line](https://en.wikipedia.org/wiki/Real_line). |
644 | 646 | ||
645 | 647 | ||
648 | ## Token names | ||
649 | |||
650 | Use `T![foo]` instead of `SyntaxKind::FOO_KW`. | ||
651 | |||
652 | ```rust | ||
653 | // GOOD | ||
654 | match p.current() { | ||
655 | T![true] | T![false] => true, | ||
656 | _ => false, | ||
657 | } | ||
658 | |||
659 | // BAD | ||
660 | |||
661 | match p.current() { | ||
662 | SyntaxKind::TRUE_KW | SyntaxKind::FALSE_KW => true, | ||
663 | _ => false, | ||
664 | } | ||
665 | ``` | ||
666 | |||
667 | **Rationale:** The macro uses the familiar Rust syntax, avoiding ambiguities like "is this a brace or bracket?". | ||
668 | |||
646 | ## Documentation | 669 | ## Documentation |
647 | 670 | ||
648 | For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. | 671 | For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. |