mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Fix comment prefix method for four slash comments
This commit is contained in:
parent
b6560e3ebb
commit
0bd7d81805
1 changed files with 6 additions and 10 deletions
|
@ -13,7 +13,12 @@ impl Comment {
|
|||
}
|
||||
|
||||
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 a new issue