Skip to content
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

[Minor]: Refactor to use Result.transpose() #11882

Merged
merged 1 commit into from
Aug 8, 2024
Merged

Conversation

djanderson
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

Refactors an explicit Result<Option<T>> to Option<Result<T>> conversion to use the equivalent .transpose() method on Result.

Ok(None) will be mapped to None. Ok(Some()) and Err() will be mapped to Some(Ok()) and Some(Err()).

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

No.

`Result.transpose()` converts `Result<Option<T>>` to `Option<Result<T>>`.

> Ok(None) will be mapped to None. Ok(Some(_)) and Err(_) will be mapped to Some(Ok(_)) and Some(Err(_)).
- https://doc.rust-lang.org/std/result/enum.Result.html#method.transpose
@github-actions github-actions bot added the core Core DataFusion crate label Aug 7, 2024
Copy link
Member

@lewiszlw lewiszlw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code cleaner. Thanks @djanderson

@lewiszlw lewiszlw merged commit 0bbce5d into apache:main Aug 8, 2024
24 checks passed
@djanderson djanderson deleted the patch-1 branch August 8, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants