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

unnested_or_patterns trigger on master build even if feature is not enabled #5704

Closed
matthiaskrgr opened this issue Jun 10, 2020 · 2 comments · Fixed by #5758
Closed

unnested_or_patterns trigger on master build even if feature is not enabled #5704

matthiaskrgr opened this issue Jun 10, 2020 · 2 comments · Fixed by #5758
Labels
C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy

Comments

@matthiaskrgr
Copy link
Member

When using the master toolchain and a clippy built by master, the unnested_or_patterns lint triggers on crates although the or_patterns feature is not enabled in these crates.

This does not happen if the nightly-clippy is used.

See #5378 (comment) for details

dtolnay added a commit to serde-rs/serde that referenced this issue Jun 11, 2020
dtolnay added a commit to serde-rs/json that referenced this issue Jun 11, 2020
dtolnay added a commit to dtolnay/miniserde that referenced this issue Jun 11, 2020
bors added a commit that referenced this issue Jun 11, 2020
Downgrade unnested_or_patterns to pedantic

Even with #5704 fixed, I don't believe it is a safe bet that if someone is using or-patterns anywhere in a codebase then they want to use it as much as possible in the whole codebase. I think it would be reasonable to reevaluate after the feature is stable. I feel that a warn-by-default lint suggesting use of an unstable feature, even if already being used in one place, is questionable.

changelog: Remove unnested_or_patterns from default set of enabled lints
bors added a commit that referenced this issue Jun 11, 2020
Downgrade unnested_or_patterns to pedantic

Even with #5704 fixed, I don't believe it is a safe bet that if someone is using or-patterns anywhere in a codebase then they want to use it as much as possible in the whole codebase. I think it would be reasonable to reevaluate after the feature is stable. I feel that a warn-by-default lint suggesting use of an unstable feature, even if already being used in one place, is questionable.

changelog: Remove unnested_or_patterns from default set of enabled lints
@flip1995 flip1995 added C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy labels Jun 12, 2020
@CAD97
Copy link
Contributor

CAD97 commented Jun 17, 2020

I just saw this lint with cargo +nightly-2020-06-16 clippy, so I think this is triggering in nightly-clippy as well now.

@repi
Copy link

repi commented Jun 19, 2020

Ran into this with nightly (clippy 0.0.212 (e55d3f9c5 2020-06-18)) now also, this clippy suggestions:

warning: unnested or-patterns
   --> component_accessors.rs:701:13
    |
701 | /             (D6Joint::RelativePosition, _)
702 | |             | (D6Joint::RelativeRotation, _)
703 | |             | (D6Joint::RelativeAngles, _) => {
    | |__________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns
help: nest the patterns
    |
701 |             (D6Joint::RelativePosition | D6Joint::RelativeRotation |
702 |  D6Joint::RelativeAngles, _) => {

But changing the code to this does indeed fail as it is an experimental feature we do not have enabled:

error[E0658]: or-patterns syntax is experimental
   --> components/component_accessors.rs:702:17
    |
702 |                 D6Joint::RelativePosition | D6Joint::RelativeRotation | D6Joint::RelativeAngles,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
    = help: add `#![feature(or_patterns)]` to the crate attributes to enable

flip1995 added a commit to flip1995/rust-clippy that referenced this issue Jun 23, 2020
Downgrade unnested_or_patterns to pedantic

Even with rust-lang#5704 fixed, I don't believe it is a safe bet that if someone is using or-patterns anywhere in a codebase then they want to use it as much as possible in the whole codebase. I think it would be reasonable to reevaluate after the feature is stable. I feel that a warn-by-default lint suggesting use of an unstable feature, even if already being used in one place, is questionable.

changelog: Remove unnested_or_patterns from default set of enabled lints
@bors bors closed this as completed in 36b7983 Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants