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

Allow clippy::ref_option_ref #44

Closed
Kestrer opened this issue Jan 8, 2021 · 1 comment · Fixed by #45
Closed

Allow clippy::ref_option_ref #44

Kestrer opened this issue Jan 8, 2021 · 1 comment · Fixed by #45
Labels
C-bug Category: related to a bug.

Comments

@Kestrer
Copy link

Kestrer commented Jan 8, 2021

The following code:

#![warn(clippy::pedantic)]

pin_project_lite::pin_project! {
    struct X<'a> {
        inner: Option<&'a mut i32>,
    }
}

Generates a warning when run using Clippy:

warning: since `&` implements the `Copy` trait, `&Option<&T>` can be simplified to `Option<&T>`
 --> src/lib.rs:3:1
  |
3 | / pin_project_lite::pin_project! {
4 | |     struct X<'a> {
5 | |         inner: Option<&'a mut i32>,
6 | |     }
7 | | }
  | |_^
  |
note: the lint level is defined here
 --> src/lib.rs:1:9
  |
1 | #![warn(clippy::pedantic)]
  |         ^^^^^^^^^^^^^^^^
  = note: `#[warn(clippy::ref_option_ref)]` implied by `#[warn(clippy::pedantic)]`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_option_ref
  = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

It would be very appreciated if this could be avoided.

@taiki-e taiki-e added the C-bug Category: related to a bug. label Jan 9, 2021
@bors bors bot closed this as completed in ea107f6 Jan 9, 2021
@taiki-e
Copy link
Owner

taiki-e commented Jan 9, 2021

Thanks for the report! Published 0.2.2 which fixes this issue.

bors bot added a commit to taiki-e/pin-project that referenced this issue Jan 9, 2021
308: Suppress clippy::ref_option_ref lint in generated code r=taiki-e a=taiki-e

taiki-e/pin-project-lite#44

Co-authored-by: Taiki Endo <te316e89@gmail.com>
bors bot added a commit to taiki-e/pin-project that referenced this issue Jan 9, 2021
308: Suppress clippy::ref_option_ref lint in generated code r=taiki-e a=taiki-e

taiki-e/pin-project-lite#44

Co-authored-by: Taiki Endo <te316e89@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants