Skip to content

Commit cb24a63

Browse files
committed
tests: Fix non_local_definitions warning
``` error: non-local `impl` definition, they should be avoided as they go against expectation --> tests/pinned_drop.rs:140:17 | 140 | / impl S { 141 | | fn _f(self) -> Self { 142 | | self 143 | | } 144 | | } | |_________________^ | = help: move this `impl` block outside the of the current function `__drop_inner` and up 3 bodies = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <rust-lang/rust#120363> = note: `-D non-local-definitions` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(non_local_definitions)]` ```
1 parent d42e9cc commit cb24a63

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/pinned_drop.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ fn self_inside_macro_containing_fn() {
137137
impl PinnedDrop for S {
138138
fn drop(self: Pin<&mut Self>) {
139139
mac!({
140+
#[allow(dead_code)]
141+
struct S(());
140142
impl S {
141143
fn _f(self) -> Self {
142144
self

0 commit comments

Comments
 (0)