Skip to content

none_else_block #9094

Closed
Closed
@b-NC

Description

@b-NC

What it does

transform if else block into then_some() call if else block returns None

Lint Name

none_else_block

Category

pedantic

Advantage

No response

Drawbacks

No response

Example

let a = true;

if a == true {
      Some("asd")
} else {
      None
}
  |
  v
a.then_some("asd");

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsgood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions