Skip to content

Commit 287979f

Browse files
committed
Pass char when checking for single character starts_with
1 parent b539d5a commit 287979f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/parse.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ impl<'a> Cursor<'a> {
2727
self.rest.starts_with(s)
2828
}
2929

30+
fn starts_with_char(&self, ch: char) -> bool {
31+
self.rest.starts_with(ch)
32+
}
33+
3034
fn is_empty(&self) -> bool {
3135
self.rest.is_empty()
3236
}
@@ -756,7 +760,7 @@ fn digits(mut input: Cursor) -> Result<Cursor, Reject> {
756760
fn punct(input: Cursor) -> PResult<Punct> {
757761
let (rest, ch) = punct_char(input)?;
758762
if ch == '\'' {
759-
if ident_any(rest)?.0.starts_with("'") {
763+
if ident_any(rest)?.0.starts_with_char('\'') {
760764
Err(Reject)
761765
} else {
762766
Ok((rest, Punct::new('\'', Spacing::Joint)))
@@ -848,7 +852,7 @@ fn doc_comment_contents(input: Cursor) -> PResult<(&str, bool)> {
848852
Ok((input, (&s[3..s.len() - 2], true)))
849853
} else if input.starts_with("///") {
850854
let input = input.advance(3);
851-
if input.starts_with("/") {
855+
if input.starts_with_char('/') {
852856
return Err(Reject);
853857
}
854858
let (input, s) = take_until_newline_or_eof(input);

0 commit comments

Comments
 (0)