Skip to content

Commit

Permalink
Use peek2 defined on the parser
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmanila committed May 20, 2024
1 parent edf309f commit 56ee76e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/ruff_python_parser/src/parser/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2405,9 +2405,7 @@ impl<'src> Parser<'src> {
range: self.node_range(start),
})
}
TokenKind::Newline
if matches!(self.tokens.peek2(), (TokenKind::Indent, TokenKind::Case)) =>
{
TokenKind::Newline if matches!(self.peek2(), (TokenKind::Indent, TokenKind::Case)) => {
// `match` is a keyword
self.add_error(
ParseErrorType::ExpectedToken {
Expand Down Expand Up @@ -3514,7 +3512,7 @@ impl<'src> Parser<'src> {
fn classify_match_token(&mut self) -> MatchTokenKind {
assert_eq!(self.current_token_kind(), TokenKind::Match);

let (first, second) = self.tokens.peek2();
let (first, second) = self.peek2();

match first {
TokenKind::Not if second == TokenKind::In => MatchTokenKind::Identifier,
Expand Down

0 comments on commit 56ee76e

Please sign in to comment.