Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

clippy: Replace if let Some() = res.ok() with if let Ok() = res #31525

Merged
merged 1 commit into from
May 8, 2023

Conversation

brooksprumo
Copy link
Contributor

@brooksprumo brooksprumo commented May 6, 2023

Problem

Clippy throws warnings on the next nightly version (1.70.0), which blocks upgrading our nightly Rust (see #31381).

These warnings are for the pattern:

if let Some(val) = result.ok() { ... }

which can instead be:

if let Ok(val) = result { ... }

Summary of Changes

Use if let Ok instead.

@brooksprumo brooksprumo marked this pull request as ready for review May 6, 2023 15:47
@codecov
Copy link

codecov bot commented May 6, 2023

Codecov Report

Merging #31525 (7ddf94b) into master (775639c) will increase coverage by 0.0%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #31525   +/-   ##
=======================================
  Coverage    81.4%    81.4%           
=======================================
  Files         731      731           
  Lines      205088   205088           
=======================================
+ Hits       166944   166952    +8     
+ Misses      38144    38136    -8     

@brooksprumo brooksprumo requested review from ryoqun and ilya-bobyr May 6, 2023 16:56
@ilya-bobyr
Copy link
Contributor

I did a similar cleanup here: #30808
Though, I've addressed all the warnings from the nightly clippy.
Tyera didn't like it :(
Let's sneak it in, while she is not looking >:)

@CriesofCarrots
Copy link
Contributor

I did a similar cleanup here: #30808 Though, I've addressed all the warnings from the nightly clippy. Tyera didn't like it :( Let's sneak it in, while she is not looking >:)

👀 I'm always watching... 😅 jk!
To be fair, I just wanted to understand why you picked lints from that particular nightly, and also didn't want to add in a bunch of comments that would need to be cleaned up or uncommented on the next update. I've no objection to lint cleanup generally or this PR in particular :)

@ilya-bobyr
Copy link
Contributor

I did a similar cleanup here: #30808 Though, I've addressed all the warnings from the nightly clippy. Tyera didn't like it :( Let's sneak it in, while she is not looking >:)

👀 I'm always watching... 😅 jk! To be fair, I just wanted to understand why you picked lints from that particular nightly, and also didn't want to add in a bunch of comments that would need to be cleaned up or uncommented on the next update. I've no objection to lint cleanup generally or this PR in particular :)

I've exaggerated - your questions were all very reasonable :)

@brooksprumo
Copy link
Contributor Author

I plan to merge this tomorrow, unless there are any objections.

@brooksprumo brooksprumo merged commit 6cf6b8c into solana-labs:master May 8, 2023
@brooksprumo brooksprumo deleted the clippy/ok branch May 8, 2023 13:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants