diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/tokens.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/ast/tokens.rs b/crates/ra_syntax/src/ast/tokens.rs index c830cdccf..76a12cd64 100644 --- a/crates/ra_syntax/src/ast/tokens.rs +++ b/crates/ra_syntax/src/ast/tokens.rs | |||
@@ -24,9 +24,9 @@ impl<'a> Comment<'a> { | |||
24 | pub fn flavor(&self) -> CommentFlavor { | 24 | pub fn flavor(&self) -> CommentFlavor { |
25 | let text = self.text(); | 25 | let text = self.text(); |
26 | if text.starts_with("///") { | 26 | if text.starts_with("///") { |
27 | CommentFlavor::Doc | 27 | CommentFlavor::OuterDoc |
28 | } else if text.starts_with("//!") { | 28 | } else if text.starts_with("//!") { |
29 | CommentFlavor::ModuleDoc | 29 | CommentFlavor::InnerDoc |
30 | } else if text.starts_with("//") { | 30 | } else if text.starts_with("//") { |
31 | CommentFlavor::Line | 31 | CommentFlavor::Line |
32 | } else { | 32 | } else { |
@@ -46,25 +46,24 @@ impl<'a> Comment<'a> { | |||
46 | #[derive(Debug, PartialEq, Eq)] | 46 | #[derive(Debug, PartialEq, Eq)] |
47 | pub enum CommentFlavor { | 47 | pub enum CommentFlavor { |
48 | Line, | 48 | Line, |
49 | Doc, | 49 | OuterDoc, |
50 | ModuleDoc, | 50 | InnerDoc, |
51 | Multiline, | 51 | Multiline, |
52 | } | 52 | } |
53 | 53 | ||
54 | impl CommentFlavor { | 54 | impl CommentFlavor { |
55 | pub fn prefix(&self) -> &'static str { | 55 | pub fn prefix(&self) -> &'static str { |
56 | use self::CommentFlavor::*; | ||
57 | match *self { | 56 | match *self { |
58 | Line => "//", | 57 | CommentFlavor::Line => "//", |
59 | Doc => "///", | 58 | CommentFlavor::OuterDoc => "///", |
60 | ModuleDoc => "//!", | 59 | CommentFlavor::InnerDoc => "//!", |
61 | Multiline => "/*", | 60 | CommentFlavor::Multiline => "/*", |
62 | } | 61 | } |
63 | } | 62 | } |
64 | 63 | ||
65 | pub fn is_doc_comment(&self) -> bool { | 64 | pub fn is_doc_comment(&self) -> bool { |
66 | match self { | 65 | match self { |
67 | CommentFlavor::Doc | CommentFlavor::ModuleDoc => true, | 66 | CommentFlavor::OuterDoc | CommentFlavor::InnerDoc => true, |
68 | _ => false, | 67 | _ => false, |
69 | } | 68 | } |
70 | } | 69 | } |