From 991fd19b87df60d433fd903c3e13a31418426b09 Mon Sep 17 00:00:00 2001 From: Nickolay Ponomarev Date: Sun, 13 Jan 2019 20:36:29 +0300 Subject: [PATCH] Stop nesting `match` in parse_compound_identifier (4/8) --- src/sqlparser.rs | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/sqlparser.rs b/src/sqlparser.rs index 613690da..ad5a1c97 100644 --- a/src/sqlparser.rs +++ b/src/sqlparser.rs @@ -951,30 +951,24 @@ impl Parser { loop { let token = &self.next_token(); match token { - Some(token) => match token { - Token::SQLWord(s) => { - if expect_identifier { - expect_identifier = false; - idents.push(s.to_string()); - } else { - self.prev_token(); - break; - } - } - token if token == separator => { - if expect_identifier { - return parser_err!(format!("Expecting identifier, found {:?}", token)); - } else { - expect_identifier = true; - continue; - } - } - _ => { + Some(Token::SQLWord(s)) => { + if expect_identifier { + expect_identifier = false; + idents.push(s.to_string()); + } else { self.prev_token(); break; } - }, - None => { + } + Some(token) if token == separator => { + if expect_identifier { + return parser_err!(format!("Expecting identifier, found {:?}", token)); + } else { + expect_identifier = true; + continue; + } + } + _ => { self.prev_token(); break; }