Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyass committed Nov 7, 2021
1 parent 414d3dc commit 42bf210
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,14 @@ impl fmt::Display for WindowSpec {
write!(f, "ORDER BY {}", display_comma_separated(&self.order_by))?;
}
if let Some(window_frame) = &self.window_frame {
f.write_str(delim)?;
if let Some(end_bound) = &window_frame.end_bound {
f.write_str(delim)?;
write!(
f,
"{} BETWEEN {} AND {}",
window_frame.units, window_frame.start_bound, end_bound
)?;
} else {
f.write_str(delim)?;
write!(f, "{} {}", window_frame.units, window_frame.start_bound)?;
}
}
Expand Down
15 changes: 8 additions & 7 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1620,9 +1620,10 @@ impl<'a> Parser<'a> {
loop {
if let Some(constraint) = self.parse_optional_table_constraint()? {
constraints.push(constraint);
} else if let Token::Word(_) = self.peek_token() {
columns.push(self.parse_column_def()?);
} else if let Token::BackQuotedString(_) = self.peek_token() {
} else if matches!(
self.peek_token(),
Token::Word(_) | Token::BackQuotedString(_)
) {
columns.push(self.parse_column_def()?);
} else {
return self.expected("column name or constraint definition", self.peek_token());
Expand Down Expand Up @@ -2793,10 +2794,10 @@ impl<'a> Parser<'a> {
// followed by some joins or (B) another level of nesting.
let mut table_and_joins = self.parse_table_and_joins()?;

if !table_and_joins.joins.is_empty() {
self.expect_token(&Token::RParen)?;
Ok(TableFactor::NestedJoin(Box::new(table_and_joins))) // (A)
} else if let TableFactor::NestedJoin(_) = &table_and_joins.relation {
if !table_and_joins.joins.is_empty()
|| matches!(&table_and_joins.relation, TableFactor::NestedJoin(_))
{
// (A)
// (B): `table_and_joins` (what we found inside the parentheses)
// is a nested join `(foo JOIN bar)`, not followed by other joins.
self.expect_token(&Token::RParen)?;
Expand Down

0 comments on commit 42bf210

Please sign in to comment.