We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6560e3 commit 0bd7d81Copy full SHA for 0bd7d81
crates/ra_syntax/src/ast/tokens.rs
@@ -13,7 +13,12 @@ impl Comment {
13
}
14
15
pub fn prefix(&self) -> &'static str {
16
- prefix_by_kind(self.kind())
+ for (prefix, k) in COMMENT_PREFIX_TO_KIND.iter() {
17
+ if *k == self.kind() && self.text().starts_with(prefix) {
18
+ return prefix;
19
+ }
20
21
+ unreachable!()
22
23
24
@@ -70,15 +75,6 @@ fn kind_by_prefix(text: &str) -> CommentKind {
70
75
panic!("bad comment text: {:?}", text)
71
76
72
77
73
-fn prefix_by_kind(kind: CommentKind) -> &'static str {
74
- for (prefix, k) in COMMENT_PREFIX_TO_KIND.iter() {
- if *k == kind {
- return prefix;
- }
78
79
- unreachable!()
80
-}
81
-
82
impl Whitespace {
83
pub fn spans_multiple_lines(&self) -> bool {
84
let text = self.text();
0 commit comments