Refine parse nulls first
@@ -278,17 +278,14 @@ pub fn join_operator(i: Input) -> IResult<JoinOperator> {
pub fn order_by_expr(i: Input) -> IResult<OrderByExpr> {
let nulls_first = map(
rule! {
- NULLS ~ ( FIRST | LAST )?
- },
- |(_, opt_first_last)| match opt_first_last {
- None => unreachable!(),
- Some(token) => token.kind == FIRST,
+ NULLS ~ ( FIRST | LAST )
},
+ |(_, first_last)| first_last.kind == FIRST,
);
map(
rule! {
- #expr ~ ( ASC | DESC )? ~ (#nulls_first)?
+ #expr ~ ( ASC | DESC )? ~ #nulls_first?
},
|(expr, opt_asc, opt_nulls_first)| OrderByExpr {
expr,
