Skip to content

Commit 405b28e

Browse files
committed
Apply clippy to doctest
taiki-e/github-actions@96af4dc ``` error: unreachable `pub` item --> pin-project-internal/src/lib.rs:359:1 | 359 | pub trait PinnedDrop { | ---^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates = note: requested on the command line with `-D unreachable-pub` error: unsafe impl missing a safety comment --> pin-project-internal/src/lib.rs:328:1 | 328 | unsafe impl<T: Unpin, U> UnsafeUnpin for Struct<T, U> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a safety comment on the preceding line = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks = note: requested on the command line with `-D clippy::undocumented-unsafe-blocks` error: unreachable `pub` item --> pin-project-internal/src/lib.rs:503:1 | 503 | pub trait PinnedDrop { | ---^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates = note: requested on the command line with `-D unreachable-pub` error: unreachable `pub` item --> pin-project-internal/src/lib.rs:555:1 | 555 | pub trait PinnedDrop { | ---^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates = note: requested on the command line with `-D unreachable-pub` ```
1 parent ade4308 commit 405b28e

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

pin-project-internal/src/lib.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
55
#![doc(test(
66
no_crate_inject,
7-
attr(
8-
deny(warnings, rust_2018_idioms, single_use_lifetimes),
9-
allow(dead_code, unused_variables)
10-
)
7+
attr(allow(
8+
dead_code,
9+
unused_variables,
10+
clippy::undocumented_unsafe_blocks,
11+
clippy::unused_trait_names,
12+
))
1113
))]
1214
#![forbid(unsafe_code)]
1315
#![allow(clippy::needless_doctest_main)]
@@ -325,6 +327,7 @@ use proc_macro::TokenStream;
325327
/// unpinned: U,
326328
/// }
327329
///
330+
/// # #[allow(clippy::undocumented_unsafe_blocks)]
328331
/// unsafe impl<T: Unpin, U> UnsafeUnpin for Struct<T, U> {}
329332
/// ```
330333
///
@@ -356,6 +359,7 @@ use proc_macro::TokenStream;
356359
///
357360
/// ```
358361
/// # use std::pin::Pin;
362+
/// # #[allow(unreachable_pub)]
359363
/// pub trait PinnedDrop {
360364
/// fn drop(self: Pin<&mut Self>);
361365
/// }
@@ -500,6 +504,7 @@ pub fn pin_project(args: TokenStream, input: TokenStream) -> TokenStream {
500504
///
501505
/// ```
502506
/// # use std::pin::Pin;
507+
/// # #[allow(unreachable_pub)]
503508
/// pub trait PinnedDrop {
504509
/// fn drop(self: Pin<&mut Self>);
505510
/// }
@@ -552,6 +557,7 @@ pub fn pin_project(args: TokenStream, input: TokenStream) -> TokenStream {
552557
///
553558
/// ```
554559
/// # use std::pin::Pin;
560+
/// # #[allow(unreachable_pub)]
555561
/// pub trait PinnedDrop {
556562
/// unsafe fn drop(self: Pin<&mut Self>);
557563
/// }

src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ see [examples] directory for more examples and generated code.
9393
#![no_std]
9494
#![doc(test(
9595
no_crate_inject,
96-
attr(
97-
deny(warnings, rust_2018_idioms, single_use_lifetimes),
98-
allow(dead_code, unused_variables)
99-
)
96+
attr(allow(
97+
dead_code,
98+
unused_variables,
99+
clippy::undocumented_unsafe_blocks,
100+
clippy::unused_trait_names,
101+
))
100102
))]
101103
#![warn(
102104
// Lints that may help when writing public library.
@@ -170,6 +172,7 @@ pub use pin_project_internal::pinned_drop;
170172
/// field_2: V,
171173
/// }
172174
///
175+
/// # #[allow(clippy::undocumented_unsafe_blocks)]
173176
/// unsafe impl<K, V> UnsafeUnpin for Struct<K, V> where K: Unpin + Clone {}
174177
/// ```
175178
///

tests/lint/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ publish = false
66

77
[lib]
88
path = "lib.rs"
9+
doctest = false
910

1011
[dependencies]
1112
pin-project = { path = "../.." }

0 commit comments

Comments
 (0)