Fix comment prefix method for four slash comments
This commit is contained in:
parent
b6560e3ebb
commit
0bd7d81805
@ -13,7 +13,12 @@ pub fn kind(&self) -> CommentKind {
|
||||
}
|
||||
|
||||
pub fn prefix(&self) -> &'static str {
|
||||
prefix_by_kind(self.kind())
|
||||
for (prefix, k) in COMMENT_PREFIX_TO_KIND.iter() {
|
||||
if *k == self.kind() && self.text().starts_with(prefix) {
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,15 +75,6 @@ fn kind_by_prefix(text: &str) -> CommentKind {
|
||||
panic!("bad comment text: {:?}", text)
|
||||
}
|
||||
|
||||
fn prefix_by_kind(kind: CommentKind) -> &'static str {
|
||||
for (prefix, k) in COMMENT_PREFIX_TO_KIND.iter() {
|
||||
if *k == kind {
|
||||
return prefix;
|
||||
}
|
||||
}
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
impl Whitespace {
|
||||
pub fn spans_multiple_lines(&self) -> bool {
|
||||
let text = self.text();
|
||||
|
Loading…
Reference in New Issue
Block a user