From fedf8341eedd6fc0ad5c5336d1747463c7d85ece Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 25 Feb 2024 19:50:16 -0800 Subject: [PATCH] Ignore non_local_definitions false positive in test https://github.com/rust-lang/rust/issues/121621 warning: non-local `impl` definition, they should be avoided as they go against expectation --> tests/test.rs:2338:5 | 2338 | / impl<'de> Deserialize<'de> for &'de RawMapKey { 2339 | | fn deserialize(deserializer: D) -> Result 2340 | | where 2341 | | D: serde::Deserializer<'de>, ... | 2345 | | } 2346 | | } | |_____^ | = help: move this `impl` block outside the of the current function `test_raw_value_in_map_key` = 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 = note: `#[warn(non_local_definitions)]` on by default --- tests/test.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test.rs b/tests/test.rs index 543dbd0b1..c227b9066 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -2335,6 +2335,8 @@ fn test_raw_value_in_map_key() { #[repr(transparent)] struct RawMapKey(RawValue); + #[allow(unknown_lints)] + #[allow(non_local_definitions)] // false positive: https://github.com/rust-lang/rust/issues/121621 impl<'de> Deserialize<'de> for &'de RawMapKey { fn deserialize(deserializer: D) -> Result where