Skip to content

Commit 362420c

Browse files
committed
Fix complex blocks warning when running clippy
``` warning: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let` --> src/dialect/postgresql.rs:233:74 | 233 | match parser.maybe_parse(|parser| -> Result<ObjectName, ParserError> { | __________________________________________________________________________^ 234 | | parser.expect_keyword(Keyword::CREATE)?; 235 | | parser.expect_keyword(Keyword::TYPE)?; 236 | | let name = parser.parse_object_name(false)?; ... | 239 | | Ok(name) 240 | | }) { | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions = note: `#[warn(clippy::blocks_in_conditions)]` on by default ```
1 parent ee90373 commit 362420c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/dialect/postgresql.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,16 @@ pub fn parse_comment(parser: &mut Parser) -> Result<Statement, ParserError> {
230230
}
231231

232232
pub fn parse_create(parser: &mut Parser) -> Option<Result<Statement, ParserError>> {
233-
match parser.maybe_parse(|parser| -> Result<ObjectName, ParserError> {
233+
let name = parser.maybe_parse(|parser| -> Result<ObjectName, ParserError> {
234234
parser.expect_keyword(Keyword::CREATE)?;
235235
parser.expect_keyword(Keyword::TYPE)?;
236236
let name = parser.parse_object_name(false)?;
237237
parser.expect_keyword(Keyword::AS)?;
238238
parser.expect_keyword(Keyword::ENUM)?;
239239
Ok(name)
240-
}) {
240+
});
241+
242+
match name {
241243
Ok(name) => name.map(|name| parse_create_type_as_enum(parser, name)),
242244
Err(e) => Some(Err(e)),
243245
}

0 commit comments

Comments
 (0)