Skip to content

extend obfuscated_if_else to support {then(), then_some()}.unwrap_or_else() #14165

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

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

lapla-cogito
Copy link
Contributor

These method chains can be expressed concisely with if/else.

changelog: [obfuscated_if_else]: support then().unwrap_or_else() and then_some().unwrap_or_else()

@rustbot
Copy link
Collaborator

rustbot commented Feb 6, 2025

r? @blyxyas

rustbot has assigned @blyxyas.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 6, 2025
@lapla-cogito lapla-cogito force-pushed the obfusifelse_unwraporelse branch 3 times, most recently from 4c00a09 to 9642c7d Compare February 9, 2025 01:40
@lapla-cogito
Copy link
Contributor Author

Rebased.

@lapla-cogito lapla-cogito force-pushed the obfusifelse_unwraporelse branch from 9642c7d to 264403a Compare February 15, 2025 21:10
@lapla-cogito
Copy link
Contributor Author

Rebased.

@lapla-cogito
Copy link
Contributor Author

@blyxyas Should I reassign? (I pinged you because it's been over 2 weeks)

@blyxyas
Copy link
Member

blyxyas commented Feb 21, 2025

Sorry, this issue in particular has slipped under the radar on my org system. I will get a review today (I will start a review right now)

Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

Looking good! Just some comments (one logical observation, and one nit).

@lapla-cogito lapla-cogito force-pushed the obfusifelse_unwraporelse branch 3 times, most recently from 66d3a9c to a8a6598 Compare February 21, 2025 18:20
@lapla-cogito lapla-cogito force-pushed the obfusifelse_unwraporelse branch from a8a6598 to 6c6ffd2 Compare February 21, 2025 18:22
@lapla-cogito lapla-cogito requested a review from blyxyas February 21, 2025 18:25
Copy link
Member

@blyxyas blyxyas left a comment

Choose a reason for hiding this comment

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

LGTM, great change, thanks! ❤️

@blyxyas blyxyas added this pull request to the merge queue Feb 24, 2025
Merged via the queue into rust-lang:master with commit 0fb004d Feb 24, 2025
11 checks passed
rye added a commit to frog-pond/ccc-server-next that referenced this pull request Apr 10, 2025
With Rust 1.87 beta, clippy started warning about some new instances of
the obfuscated-if-else lint. This appears to have been introduced in
rust-lang/rust-clippy#14165, which was a change that made sense to me.

But because we deny the warn-by-default group, clippy::all, CI began
failing, which is fine.

This commit resolves the two instances of this lint in the codebase by
using inline if-else's.

Signed-off-by: Kristofer Rye <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants