Skip to content

Commit 64f548f

Browse files
committed
Suppress clippy::ref_option_ref lint in generated code
1 parent 5ebc0e7 commit 64f548f

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
1010

1111
## [Unreleased]
1212

13+
- Suppress `clippy::ref_option_ref` lint in generated code.
14+
1315
## [1.0.3] - 2021-01-05
1416

1517
- Exclude unneeded files from crates.io.

pin-project-internal/src/pin_project/derive.rs

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ fn proj_allowed_lints(kind: TypeKind) -> (TokenStream, TokenStream, TokenStream)
133133
let proj_ref = quote! {
134134
#global_allowed_lints
135135
#[allow(dead_code)] // This lint warns unused fields/variants.
136+
#[allow(clippy::ref_option_ref)] // This lint warns `&Option<&<ty>>`.
136137
#[allow(clippy::type_repetition_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/4326
137138
};
138139
let proj_own = quote! {

tests/lint.rs

+22
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,28 @@ pub mod clippy_used_underscore_binding {
10231023
}
10241024
}
10251025

1026+
pub mod clippy_ref_option_ref {
1027+
use pin_project::pin_project;
1028+
1029+
#[pin_project]
1030+
#[derive(Debug)]
1031+
pub struct Struct<'a> {
1032+
#[pin]
1033+
pub _pinned: Option<&'a ()>,
1034+
pub _unpinned: Option<&'a ()>,
1035+
}
1036+
1037+
#[pin_project(project = EnumProj, project_ref = EnumProjRef)]
1038+
#[derive(Debug)]
1039+
pub enum Enum<'a> {
1040+
Struct {
1041+
#[pin]
1042+
_pinned: Option<&'a ()>,
1043+
_unpinned: Option<&'a ()>,
1044+
},
1045+
}
1046+
}
1047+
10261048
// Run `./dev.sh +$toolchain test --test lint` to update this.
10271049
#[cfg(not(miri))]
10281050
#[allow(clippy::restriction)]

0 commit comments

Comments
 (0)