Skip to content

Commit 42bf210

Browse files
committed
fix lint
1 parent 414d3dc commit 42bf210

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/ast/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -433,15 +433,14 @@ impl fmt::Display for WindowSpec {
433433
write!(f, "ORDER BY {}", display_comma_separated(&self.order_by))?;
434434
}
435435
if let Some(window_frame) = &self.window_frame {
436+
f.write_str(delim)?;
436437
if let Some(end_bound) = &window_frame.end_bound {
437-
f.write_str(delim)?;
438438
write!(
439439
f,
440440
"{} BETWEEN {} AND {}",
441441
window_frame.units, window_frame.start_bound, end_bound
442442
)?;
443443
} else {
444-
f.write_str(delim)?;
445444
write!(f, "{} {}", window_frame.units, window_frame.start_bound)?;
446445
}
447446
}

src/parser.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -1620,9 +1620,10 @@ impl<'a> Parser<'a> {
16201620
loop {
16211621
if let Some(constraint) = self.parse_optional_table_constraint()? {
16221622
constraints.push(constraint);
1623-
} else if let Token::Word(_) = self.peek_token() {
1624-
columns.push(self.parse_column_def()?);
1625-
} else if let Token::BackQuotedString(_) = self.peek_token() {
1623+
} else if matches!(
1624+
self.peek_token(),
1625+
Token::Word(_) | Token::BackQuotedString(_)
1626+
) {
16261627
columns.push(self.parse_column_def()?);
16271628
} else {
16281629
return self.expected("column name or constraint definition", self.peek_token());
@@ -2793,10 +2794,10 @@ impl<'a> Parser<'a> {
27932794
// followed by some joins or (B) another level of nesting.
27942795
let mut table_and_joins = self.parse_table_and_joins()?;
27952796

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

0 commit comments

Comments
 (0)