summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/use_self_trait.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/use_self_trait.rs')
-rw-r--r--src/tools/clippy/tests/ui/use_self_trait.rs39
1 files changed, 38 insertions, 1 deletions
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<T: std::fmt::Display>(_msg: T) -> Self;
+ }
+
+ impl Error for std::fmt::Error {
+ fn custom<T: std::fmt::Display>(_msg: T) -> Self {
+ std::fmt::Error // Should lint
+ }
+ }
+}
+
fn main() {}