Skip to content

fix(lint): don't suggest refutable patterns to "fix" irrefutable bind - #89314

Merged
bors merged 1 commit into
rust-lang:masterfrom
notriddle:notriddle/lint-fix-enum-variant-match
Oct 1, 2021
Merged

fix(lint): don't suggest refutable patterns to "fix" irrefutable bind#89314
bors merged 1 commit into
rust-lang:masterfrom
notriddle:notriddle/lint-fix-enum-variant-match

Conversation

@notriddle

@notriddlenotriddle commented Sep 28, 2021

Copy link
Copy Markdown
Contributor

In function arguments and let bindings, do not suggest changing C to Foo::C unless C is the only variant of Foo, because it won't work.

The general warning is still kept, because code like this is confusing.

Fixes#88730

p.s. src/test/ui/lint/lint-uppercase-variables.rs already tests the one-variant case.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 28, 2021
@notriddle
notriddleforce-pushed the notriddle/lint-fix-enum-variant-match branch from 3d4ccfb to f514884CompareSeptember 28, 2021 00:23

@davidtwcodavidtwco left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@davidtwco

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Sep 28, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit f5148848e579836251720804a5b3725cd8772d5a has been approved by davidtwco

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 28, 2021
@bors

bors commented Sep 29, 2021

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #88950) made this pull request unmergeable. Please resolve the merge conflicts.

@borsbors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 29, 2021
In function arguments and let bindings, do not suggest changing `C` to `Foo::C`
unless `C` is the only variant of `Foo`, because it won't work.
The general warning is still kept, because code like this is confusing.
Fixesrust-lang#88730
@notriddle
notriddleforce-pushed the notriddle/lint-fix-enum-variant-match branch from f514884 to 6e973f0CompareSeptember 29, 2021 16:15
@notriddle

Copy link
Copy Markdown
ContributorAuthor

@davidtwco I had to rebase this, because some pattern matching machinery changed.

@davidtwco

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Sep 29, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 6e973f0 has been approved by davidtwco

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 29, 2021
ehuss added a commit to ehuss/rust that referenced this pull request Sep 30, 2021
…ariant-match, r=davidtwco
fix(lint): don't suggest refutable patterns to "fix" irrefutable bind
In function arguments and let bindings, do not suggest changing `C` to `Foo::C` unless `C` is the only variant of `Foo`, because it won't work.
The general warning is still kept, because code like this is confusing.
Fixesrust-lang#88730
p.s. `src/test/ui/lint/lint-uppercase-variables.rs` already tests the one-variant case.
@ehussehuss mentioned this pull request Sep 30, 2021
Manishearth added a commit to Manishearth/rust that referenced this pull request Sep 30, 2021
…ariant-match, r=davidtwco
fix(lint): don't suggest refutable patterns to "fix" irrefutable bind
In function arguments and let bindings, do not suggest changing `C` to `Foo::C` unless `C` is the only variant of `Foo`, because it won't work.
The general warning is still kept, because code like this is confusing.
Fixesrust-lang#88730
p.s. `src/test/ui/lint/lint-uppercase-variables.rs` already tests the one-variant case.
Manishearth added a commit to Manishearth/rust that referenced this pull request Sep 30, 2021
…ariant-match, r=davidtwco
fix(lint): don't suggest refutable patterns to "fix" irrefutable bind
In function arguments and let bindings, do not suggest changing `C` to `Foo::C` unless `C` is the only variant of `Foo`, because it won't work.
The general warning is still kept, because code like this is confusing.
Fixesrust-lang#88730
p.s. `src/test/ui/lint/lint-uppercase-variables.rs` already tests the one-variant case.
@ManishearthManishearth mentioned this pull request Oct 1, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 1, 2021
…arth
Rollup of 8 pull requests
Successful merges:
- rust-lang#88782 (Fix ICE when `start` lang item has wrong generics)
- rust-lang#89202 (Resolve infered types when complaining about unexpected call type )
- rust-lang#89248 (Suggest similarly named associated items in trait impls)
- rust-lang#89303 (Add `#[must_not_suspend]` to some types in std)
- rust-lang#89306 (thread: implements available_concurrency on haiku)
- rust-lang#89314 (fix(lint): don't suggest refutable patterns to "fix" irrefutable bind)
- rust-lang#89370 (CTFE: tweak aggregate rvalue handling)
- rust-lang#89392 (bootstrap: Update comment in config.library.toml.)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit fbc67b5 into rust-lang:masterOct 1, 2021
@rustbotrustbot added this to the 1.57.0 milestone Oct 1, 2021
@notriddle
notriddle deleted the notriddle/lint-fix-enum-variant-match branch October 1, 2021 06:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bindings_with_variant_name is unhelpful and incorrect for function arguments

5 participants

@notriddle@rust-highfive@davidtwco@bors@rustbot