Skip to content

Commit 6444997

Browse files
committed
Avoid introducing new method
1 parent e77c6ec commit 6444997

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/parser/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4543,13 +4543,7 @@ impl<'a> Parser<'a> {
45434543
///
45444544
/// Returns true if the current token matches the expected keyword.
45454545
pub fn peek_keyword(&self, expected: Keyword) -> bool {
4546-
self.peek_keyword_one_of(&[expected])
4547-
}
4548-
4549-
#[must_use]
4550-
/// Checks whether the current token is one of the expected keywords without consuming it.
4551-
fn peek_keyword_one_of(&self, expected: &[Keyword]) -> bool {
4552-
matches!(&self.peek_token_ref().token, Token::Word(w) if expected.contains(&w.keyword))
4546+
matches!(&self.peek_token_ref().token, Token::Word(w) if expected == w.keyword)
45534547
}
45544548

45554549
/// If the current token is the `expected` keyword followed by
@@ -17141,7 +17135,7 @@ impl<'a> Parser<'a> {
1714117135

1714217136
let table_alias = if dialect_of!(self is OracleDialect) {
1714317137
if !self.peek_sub_query()
17144-
&& !self.peek_keyword_one_of(&[Keyword::DEFAULT, Keyword::VALUES])
17138+
&& self.peek_one_of_keywords(&[Keyword::DEFAULT, Keyword::VALUES]).is_none()
1714517139
{
1714617140
self.maybe_parse(|parser| parser.parse_identifier())?
1714717141
.map(|alias| InsertTableAlias {
@@ -19384,7 +19378,7 @@ impl<'a> Parser<'a> {
1938419378

1938519379
/// Returns true if the next keyword indicates a sub query, i.e. SELECT or WITH
1938619380
fn peek_sub_query(&mut self) -> bool {
19387-
self.peek_keyword_one_of(&[Keyword::SELECT, Keyword::WITH])
19381+
self.peek_one_of_keywords(&[Keyword::SELECT, Keyword::WITH]).is_some()
1938819382
}
1938919383

1939019384
pub(crate) fn parse_show_stmt_options(&mut self) -> Result<ShowStatementOptions, ParserError> {

0 commit comments

Comments
 (0)