Skip to content

Fix clippy lint warnings regarding indirect structural matches #606

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 3 commits into from

Conversation

jpgneves
Copy link

With #[warn(future_incompatible)], one gets a warning in the accepts! macro due an indirect structural match (see rust-lang/rust#62411).

E.g. today one gets:

warning: to use a constant of type `std::sync::Arc` in a pattern, `std::sync::Arc` must be annotated with `#[derive(PartialEq, Eq)]`
   --> postgres-types/src/lib.rs:148:19
    |
148 |                 $($crate::Type::$expected)|+ => true,
    |                   ^^^^^^^^^^^^^^^^^^^^^^^
...
944 |     accepts!(INET);
    |     --------------- in this macro invocation
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

This PR implements option number 2 in the fixes suggested in the above tracking issue, and enables the future_incompatible lint to ensure we conform.

@sfackler
Copy link
Owner

I believe this lint is allow by default because the handling is not sufficiently precise in cases just like this. This is something that should be fixed in the compiler IMO.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants