aboutsummaryrefslogtreecommitdiff
path: root/docs/dev/style.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev/style.md')
-rw-r--r--docs/dev/style.md23
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
79This makes it easier to prepare a changelog. 79This makes it easier to prepare a changelog.
80 80
81If 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.
82But many users read changelogs. 84But 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
650Use `T![foo]` instead of `SyntaxKind::FOO_KW`.
651
652```rust
653// GOOD
654match p.current() {
655 T![true] | T![false] => true,
656 _ => false,
657}
658
659// BAD
660
661match 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
648For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. 671For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines.