Skip to content

Commit a0f625b

Browse files
committed
Simplify parse_create() a little
Don't need the duplicate `columns.push()` + we advance the tokenizer, so no need to peek first.
1 parent 89602dc commit a0f625b

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

src/sqlparser.rs

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -571,28 +571,17 @@ impl Parser {
571571
};
572572
debug!("default: {:?}", default);
573573

574-
match self.peek_token() {
575-
Some(Token::Comma) => {
576-
self.next_token();
577-
columns.push(SQLColumnDef {
578-
name: column_name.as_sql_ident(),
579-
data_type: data_type,
580-
allow_null,
581-
is_primary,
582-
is_unique,
583-
default,
584-
});
585-
}
574+
columns.push(SQLColumnDef {
575+
name: column_name.as_sql_ident(),
576+
data_type: data_type,
577+
allow_null,
578+
is_primary,
579+
is_unique,
580+
default,
581+
});
582+
match self.next_token() {
583+
Some(Token::Comma) => {}
586584
Some(Token::RParen) => {
587-
self.next_token();
588-
columns.push(SQLColumnDef {
589-
name: column_name.as_sql_ident(),
590-
data_type: data_type,
591-
allow_null,
592-
is_primary,
593-
is_unique,
594-
default,
595-
});
596585
break;
597586
}
598587
other => {

0 commit comments

Comments
 (0)