Skip to content

Commit 7a2414c

Browse files
committed
Fix warning when running the cargo clippy
```shell 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 7a2414c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
- uses: actions/checkout@v4
1111
- name: Setup Rust Toolchain
1212
uses: ./.github/actions/setup-builder
13-
- run: cargo fmt -- --check
13+
- run: cargo fmt -- --check
1414

1515
lint:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
1919
- name: Setup Rust Toolchain
2020
uses: ./.github/actions/setup-builder
21-
- run: cargo clippy --all-targets --all-features -- -D warnings
21+
- run: cargo clippy --all-targets --all-features
2222

2323
compile:
2424
runs-on: ubuntu-latest

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)