From 5363f350887b1e5b5dd21a86f88c8af9d7fea6da Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:25 +0200 Subject: Merging upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/clippy/tests/ui/use_self_trait.rs | 39 ++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'src/tools/clippy/tests/ui/use_self_trait.rs') diff --git a/src/tools/clippy/tests/ui/use_self_trait.rs b/src/tools/clippy/tests/ui/use_self_trait.rs index de305d40f..325dc73b2 100644 --- a/src/tools/clippy/tests/ui/use_self_trait.rs +++ b/src/tools/clippy/tests/ui/use_self_trait.rs @@ -47,7 +47,6 @@ impl Mul for Bad { impl Clone for Bad { fn clone(&self) -> Self { - // FIXME: applicable here Bad } } @@ -112,4 +111,42 @@ impl NameTrait for u8 { } } +mod impl_in_macro { + macro_rules! parse_ip_impl { + // minimized from serde=1.0.118 + ($ty:ty) => { + impl FooTrait for $ty { + fn new() -> Self { + <$ty>::bar() + } + } + }; + } + + struct Foo; + + trait FooTrait { + fn new() -> Self; + } + + impl Foo { + fn bar() -> Self { + Self + } + } + parse_ip_impl!(Foo); // Should not lint +} + +mod full_path_replacement { + trait Error { + fn custom(_msg: T) -> Self; + } + + impl Error for std::fmt::Error { + fn custom(_msg: T) -> Self { + std::fmt::Error // Should lint + } + } +} + fn main() {} -- cgit v1.2.3