Skip to content

none_else_block #9094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
b-NC opened this issue Jul 2, 2022 · 3 comments · Fixed by #9289
Closed

none_else_block #9094

b-NC opened this issue Jul 2, 2022 · 3 comments · Fixed by #9289
Assignees
Labels
A-lint Area: New lints good first issue These issues are a good way to get started with Clippy

Comments

@b-NC
Copy link
Contributor

b-NC commented Jul 2, 2022

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");
@b-NC b-NC added the A-lint Area: New lints label Jul 2, 2022
@b-NC
Copy link
Contributor Author

b-NC commented Jul 2, 2022

@rustbot claim

@b-NC b-NC changed the title then_some none_else_block Jul 3, 2022
@b-NC b-NC removed their assignment Jul 4, 2022
@Serial-ATA
Copy link
Contributor

@rustbot label +good-first-issue

@rustbot rustbot added the good first issue These issues are a good way to get started with Clippy label Jul 28, 2022
@mkrasnitski
Copy link
Contributor

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good first issue These issues are a good way to get started with Clippy
Projects
None yet
4 participants