Navigation Menu

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

Replace non-binding if let statements #4735

Merged
merged 2 commits into from Jun 3, 2022

Conversation

djkoloski
Copy link
Contributor

Motivation

Found some if let statements that don't actually bind any variables. This can make it somewhat confusing as to whether the pattern is binding the value or being matched against (note that irrefutable if let patterns are flagged by clippy).

Solution

Switching to matches! and equality comparisons allow these to be removed.

Found some `if let` statements that don't actually bind any variables.
This can make it somewhat confusing as to whether the pattern is binding
the value or being matched against. Switching to `matches!` and equality
comparisons allow these to be removed.
@github-actions github-actions bot added the R-loom Run loom tests on this PR label Jun 2, 2022
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-sync Module: tokio/sync labels Jun 2, 2022
if let Some(NotificationType::OneWaiter) = unsafe { (*waiter.get()).notified } {
if matches!(unsafe { (*waiter.get()).notified }, Some(NotificationType::OneWaiter)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a rustfmt warning here.

@Darksonn Darksonn merged commit 0d4d3c3 into tokio-rs:master Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-sync Module: tokio/sync R-loom Run loom tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants