Skip to content
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

Should wrong_self_convention apply to self: Box<Self>, self: Rc<Self> and self: Arc<Self>? #4293

Closed
taiki-e opened this issue Jul 22, 2019 · 1 comment · Fixed by #4369
Closed
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@taiki-e
Copy link
Member

taiki-e commented Jul 22, 2019

The current wrong_self_convention warns self: Box<Self>, self: Rc<Self> and self: Arc<Self>, but they take self argument and consume self, so I think it makes sense to not warn them.

#![warn(clippy::wrong_self_convention)]

pub struct Foo;

pub struct Bar(Foo);

impl Bar {
    pub fn into_inner(self: Box<Self>) -> Foo { //~ WARNIG methods called `into_*` usually take self by value; consider choosing a less ambiguous name
        self.0
    }
}

playground

@flip1995 flip1995 added the C-bug Category: Clippy is not doing the correct thing label Jul 22, 2019
@ghost
Copy link

ghost commented Jul 25, 2019

Here is an example from the standard library:

pub fn into_vec(self: Box<[T]>) -> Vec<T>
https://doc.rust-lang.org/std/primitive.slice.html#method.into_vec

bors added a commit that referenced this issue Aug 14, 2019
 Fix `wrong_self_convention` issue

Resolves #4293

changelog: Fix `wrong_self_convention` issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants