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

Fix cargo clippy build failure with Rust 1.82 #943

Merged
merged 1 commit into from
Nov 2, 2024
Merged

Conversation

psychon
Copy link
Owner

@psychon psychon commented Nov 1, 2024

CI reports:

error: irrefutable `if let` pattern
   --> x11rb-async/examples/xclock_utc_async.rs:243:20
    |
243 |                 if let Err(e) = drive.await {
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this pattern will always match, so the `if let` is useless
    = help: consider replacing the `if let` with a `let`

Trying the suggested fix does not work with older rustc:

error[E0005]: refutable pattern in local binding
   --> x11rb-async/examples/xclock_utc_async.rs:243:21
    |
243 |                 let Err(e) = drive.await;
    |                     ^^^^^^ pattern `Ok(_)` not covered

So change this "if let" into a "match" that works everywhere.

CI reports:

error: irrefutable `if let` pattern
   --> x11rb-async/examples/xclock_utc_async.rs:243:20
    |
243 |                 if let Err(e) = drive.await {
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this pattern will always match, so the `if let` is useless
    = help: consider replacing the `if let` with a `let`

Trying the suggested fix does not work with older rustc:

error[E0005]: refutable pattern in local binding
   --> x11rb-async/examples/xclock_utc_async.rs:243:21
    |
243 |                 let Err(e) = drive.await;
    |                     ^^^^^^ pattern `Ok(_)` not covered

So change this "if let" into a "match" that works everywhere.

Signed-off-by: Uli Schlachter <[email protected]>
Copy link
Collaborator

@notgull notgull left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@mergify mergify bot merged commit 2a0d3e6 into master Nov 2, 2024
21 checks passed
@mergify mergify bot deleted the irrefutable-pattern branch November 2, 2024 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants