Skip to content

Commit e9b8fb6

Browse files
committed
Avoid introducing new method
1 parent 0f50545 commit e9b8fb6

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
@@ -4545,13 +4545,7 @@ impl<'a> Parser<'a> {
45454545
///
45464546
/// Returns true if the current token matches the expected keyword.
45474547
pub fn peek_keyword(&self, expected: Keyword) -> bool {
4548-
self.peek_keyword_one_of(&[expected])
4549-
}
4550-
4551-
#[must_use]
4552-
/// Checks whether the current token is one of the expected keywords without consuming it.
4553-
fn peek_keyword_one_of(&self, expected: &[Keyword]) -> bool {
4554-
matches!(&self.peek_token_ref().token, Token::Word(w) if expected.contains(&w.keyword))
4548+
matches!(&self.peek_token_ref().token, Token::Word(w) if expected == w.keyword)
45554549
}
45564550

45574551
/// If the current token is the `expected` keyword followed by
@@ -17174,7 +17168,7 @@ impl<'a> Parser<'a> {
1717417168

1717517169
let table_alias = if dialect_of!(self is OracleDialect) {
1717617170
if !self.peek_sub_query()
17177-
&& !self.peek_keyword_one_of(&[Keyword::DEFAULT, Keyword::VALUES])
17171+
&& self.peek_one_of_keywords(&[Keyword::DEFAULT, Keyword::VALUES]).is_none()
1717817172
{
1717917173
self.maybe_parse(|parser| parser.parse_identifier())?
1718017174
.map(|alias| InsertTableAlias {
@@ -19432,7 +19426,7 @@ impl<'a> Parser<'a> {
1943219426

1943319427
/// Returns true if the next keyword indicates a sub query, i.e. SELECT or WITH
1943419428
fn peek_sub_query(&mut self) -> bool {
19435-
self.peek_keyword_one_of(&[Keyword::SELECT, Keyword::WITH])
19429+
self.peek_one_of_keywords(&[Keyword::SELECT, Keyword::WITH]).is_some()
1943619430
}
1943719431

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

0 commit comments

Comments
 (0)