Skip to content

Commit a4a8ec2

Browse files
committed
Auto merge of rust-lang#7679 - lengyijun:issue4546, r=xFrednet
add rust-lang#4546 test changelog: none fixed rust-lang#4546 I notice rust-lang#4546 was fixed some time, I just add the tests.
2 parents 8a75002 + b68325e commit a4a8ec2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ declare_clippy_lint! {
264264
/// The method signature is controlled by the trait and often `&self` is required for all types that implement the trait
265265
/// (see e.g. the `std::string::ToString` trait).
266266
///
267+
/// Clippy allows `Pin<&Self>` and `Pin<&mut Self>` if `&self` and `&mut self` is required.
268+
///
267269
/// Please find more info here:
268270
/// https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv
269271
///

tests/ui/wrong_self_convention2.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,21 @@ mod issue3414 {
8787
}
8888
}
8989
}
90+
91+
// don't trigger
92+
mod issue4546 {
93+
use std::pin::Pin;
94+
95+
struct S;
96+
impl S {
97+
pub fn as_mut(self: Pin<&mut Self>) {}
98+
99+
pub fn as_other_thingy(self: Pin<&Self>) {}
100+
101+
pub fn is_other_thingy(self: Pin<&Self>) {}
102+
103+
pub fn to_mut(self: Pin<&mut Self>) {}
104+
105+
pub fn to_other_thingy(self: Pin<&Self>) {}
106+
}
107+
}

0 commit comments

Comments
 (0)