aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/syntax_kind.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/syntax_kind.rs')
-rw-r--r--crates/ra_parser/src/syntax_kind.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_parser/src/syntax_kind.rs b/crates/ra_parser/src/syntax_kind.rs
index 00faa7799..3efcfa403 100644
--- a/crates/ra_parser/src/syntax_kind.rs
+++ b/crates/ra_parser/src/syntax_kind.rs
@@ -1,19 +1,19 @@
1#[macro_use] 1#[macro_use]
2mod generated; 2mod generated;
3 3
4use std::fmt;
5
6pub use self::generated::SyntaxKind; 4pub use self::generated::SyntaxKind;
7 5
8impl fmt::Debug for SyntaxKind { 6impl From<u16> for SyntaxKind {
9 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 7 fn from(d: u16) -> SyntaxKind {
10 let name = self.info().name; 8 assert!(d <= (SyntaxKind::__LAST as u16));
11 f.write_str(name) 9 unsafe { std::mem::transmute::<u16, SyntaxKind>(d) }
12 } 10 }
13} 11}
14 12
15pub(crate) struct SyntaxInfo { 13impl From<SyntaxKind> for u16 {
16 pub name: &'static str, 14 fn from(k: SyntaxKind) -> u16 {
15 k as u16
16 }
17} 17}
18 18
19impl SyntaxKind { 19impl SyntaxKind {