aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/parser/src/syntax_kind.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/parser/src/syntax_kind.rs b/crates/parser/src/syntax_kind.rs
index 63204436c..9ea0e4f9b 100644
--- a/crates/parser/src/syntax_kind.rs
+++ b/crates/parser/src/syntax_kind.rs
@@ -6,6 +6,7 @@ mod generated;
6pub use self::generated::SyntaxKind; 6pub use self::generated::SyntaxKind;
7 7
8impl From<u16> for SyntaxKind { 8impl From<u16> for SyntaxKind {
9 #[inline]
9 fn from(d: u16) -> SyntaxKind { 10 fn from(d: u16) -> SyntaxKind {
10 assert!(d <= (SyntaxKind::__LAST as u16)); 11 assert!(d <= (SyntaxKind::__LAST as u16));
11 unsafe { std::mem::transmute::<u16, SyntaxKind>(d) } 12 unsafe { std::mem::transmute::<u16, SyntaxKind>(d) }
@@ -13,12 +14,14 @@ impl From<u16> for SyntaxKind {
13} 14}
14 15
15impl From<SyntaxKind> for u16 { 16impl From<SyntaxKind> for u16 {
17 #[inline]
16 fn from(k: SyntaxKind) -> u16 { 18 fn from(k: SyntaxKind) -> u16 {
17 k as u16 19 k as u16
18 } 20 }
19} 21}
20 22
21impl SyntaxKind { 23impl SyntaxKind {
24 #[inline]
22 pub fn is_trivia(self) -> bool { 25 pub fn is_trivia(self) -> bool {
23 matches!(self, SyntaxKind::WHITESPACE | SyntaxKind::COMMENT) 26 matches!(self, SyntaxKind::WHITESPACE | SyntaxKind::COMMENT)
24 } 27 }