diff options
| author | bors <bors@rust-lang.org> | 2021-09-22 09:00:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-22 09:00:30 +0000 |
| commit | a4a8ec2d52f882c711491544f6831328f04882ea (patch) | |
| tree | 9a356f00c35f07030053cb0a249ecccefe8542e4 | |
| parent | 8a75002930b67cd99ebbfd0a6b09105bde36e6aa (diff) | |
| parent | b68325ecf6dfd87d2dda5c6b3f3d3b0bcc315d3e (diff) | |
| download | rust-a4a8ec2d52f882c711491544f6831328f04882ea.tar.gz rust-a4a8ec2d52f882c711491544f6831328f04882ea.zip | |
Auto merge of #7679 - lengyijun:issue4546, r=xFrednet
add #4546 test changelog: none fixed #4546 I notice #4546 was fixed some time, I just add the tests.
| -rw-r--r-- | clippy_lints/src/methods/mod.rs | 2 | ||||
| -rw-r--r-- | tests/ui/wrong_self_convention2.rs | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index e89b2d295b9..486208f0fad 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -264,6 +264,8 @@ declare_clippy_lint! { /// The method signature is controlled by the trait and often `&self` is required for all types that implement the trait /// (see e.g. the `std::string::ToString` trait). /// + /// Clippy allows `Pin<&Self>` and `Pin<&mut Self>` if `&self` and `&mut self` is required. + /// /// Please find more info here: /// https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv /// diff --git a/tests/ui/wrong_self_convention2.rs b/tests/ui/wrong_self_convention2.rs index dd3e842c925..0d827c1feb3 100644 --- a/tests/ui/wrong_self_convention2.rs +++ b/tests/ui/wrong_self_convention2.rs @@ -87,3 +87,21 @@ mod issue3414 { } } } + +// don't trigger +mod issue4546 { + use std::pin::Pin; + + struct S; + impl S { + pub fn as_mut(self: Pin<&mut Self>) {} + + pub fn as_other_thingy(self: Pin<&Self>) {} + + pub fn is_other_thingy(self: Pin<&Self>) {} + + pub fn to_mut(self: Pin<&mut Self>) {} + + pub fn to_other_thingy(self: Pin<&Self>) {} + } +} |
