summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/use_self_trait.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/use_self_trait.fixed')
-rw-r--r--src/tools/clippy/tests/ui/use_self_trait.fixed41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/tools/clippy/tests/ui/use_self_trait.fixed b/src/tools/clippy/tests/ui/use_self_trait.fixed
index 9bcd692fb..4e779308d 100644
--- a/src/tools/clippy/tests/ui/use_self_trait.fixed
+++ b/src/tools/clippy/tests/ui/use_self_trait.fixed
@@ -47,8 +47,7 @@ impl Mul for Bad {
impl Clone for Bad {
fn clone(&self) -> Self {
- // FIXME: applicable here
- Bad
+ Self
}
}
@@ -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 {
+ Self // Should lint
+ }
+ }
+}
+
fn main() {}