Skip to content

add #4546 test #7679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
18 changes: 18 additions & 0 deletions tests/ui/wrong_self_convention2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>) {}
}
}