diff options
-rw-r--r-- | crates/parser/src/grammar/type_args.rs | 2 | ||||
-rw-r--r-- | docs/dev/style.md | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/crates/parser/src/grammar/type_args.rs b/crates/parser/src/grammar/type_args.rs index debb23fea..42cd426bd 100644 --- a/crates/parser/src/grammar/type_args.rs +++ b/crates/parser/src/grammar/type_args.rs | |||
@@ -55,7 +55,7 @@ fn generic_arg(p: &mut Parser) { | |||
55 | expressions::literal(p); | 55 | expressions::literal(p); |
56 | m.complete(p, CONST_ARG); | 56 | m.complete(p, CONST_ARG); |
57 | } | 57 | } |
58 | TRUE_KW | FALSE_KW => { | 58 | T![true] | T![false] => { |
59 | expressions::literal(p); | 59 | expressions::literal(p); |
60 | m.complete(p, CONST_ARG); | 60 | m.complete(p, CONST_ARG); |
61 | } | 61 | } |
diff --git a/docs/dev/style.md b/docs/dev/style.md index 67cbc6744..7481f8008 100644 --- a/docs/dev/style.md +++ b/docs/dev/style.md | |||
@@ -643,6 +643,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). | 643 | **Rationale:** Less-then comparisons are more intuitive, they correspond spatially to [real line](https://en.wikipedia.org/wiki/Real_line). |
644 | 644 | ||
645 | 645 | ||
646 | ## Token names | ||
647 | |||
648 | Use `T![foo]` instead of `SyntaxKind::FOO_KW`. | ||
649 | |||
650 | ```rust | ||
651 | // GOOD | ||
652 | match p.current() { | ||
653 | T![true] | T![false] => true, | ||
654 | _ => false, | ||
655 | } | ||
656 | |||
657 | // BAD | ||
658 | |||
659 | match p.current() { | ||
660 | SyntaxKind::TRUE_KW | SyntaxKind::FALSE_KW => true, | ||
661 | _ => false, | ||
662 | } | ||
663 | ``` | ||
664 | |||
665 | **Rationale:** The macro uses the familiar Rust syntax, avoiding ambiguities like "is this a brace or bracket?". | ||
666 | |||
646 | ## Documentation | 667 | ## Documentation |
647 | 668 | ||
648 | For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. | 669 | For `.md` and `.adoc` files, prefer a sentence-per-line format, don't wrap lines. |