From cc73c00d81f7b9d97aa194cce3b0381540cf1582 Mon Sep 17 00:00:00 2001 From: Young-Flash <871946895@qq.com> Date: Sun, 24 Dec 2023 20:07:33 +0800 Subject: [PATCH] add test case for negative impl --- .../trait_impl_redundant_assoc_item.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs b/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs index 8200143914..c202264bb5 100644 --- a/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs +++ b/crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs @@ -76,4 +76,24 @@ impl Marker for Foo { "#, ) } + + #[test] + fn dont_work_for_negative_impl() { + check_diagnostics( + r#" +trait Marker { + const FLAG: bool = false; + fn boo(); + fn foo () {} +} +struct Foo; +impl !Marker for Foo { + type T = i32; + const FLAG: bool = true; + fn bar() {} + fn boo() {} +} + "#, + ) + } }