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

wrong_self_convention false positive for async fn into_* #4037

Closed
Nemo157 opened this issue Apr 27, 2019 · 4 comments · Fixed by #5934
Closed

wrong_self_convention false positive for async fn into_* #4037

Nemo157 opened this issue Apr 27, 2019 · 4 comments · Fixed by #5934
Labels
E-help-wanted Call for participation: Help is requested to fix this issue. E-needs-test Call for participation: writing tests good-first-issue These issues are a good way to get started with Clippy T-async-await Type: Issues related to async/await

Comments

@Nemo157
Copy link
Member

Nemo157 commented Apr 27, 2019

#![feature(async_await)]

pub struct Foo;
pub struct Bar;

impl Foo {
    pub async fn into_bar(self) -> Bar {
        Bar
    }
}

(playground) gives

warning: methods called `into_*` usually take self by value; consider choosing a less ambiguous name
 --> src/lib.rs:7:27
  |
7 |     pub async fn into_bar(self) -> Bar {
  |                           ^^^^
  |
  = note: #[warn(clippy::wrong_self_convention)] on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention

    Finished dev [unoptimized + debuginfo] target(s) in 0.71s
@Nemo157
Copy link
Member Author

Nemo157 commented Apr 27, 2019

I haven't checked whether there are issues in async fn with the other patterns that wrong_self_convention is looking for, just noticed this one when running Clippy on a project.

@flip1995 flip1995 added the C-bug Category: Clippy is not doing the correct thing label Apr 27, 2019
@flip1995 flip1995 added the T-async-await Type: Issues related to async/await label Jun 22, 2019
@JohnTitor
Copy link
Member

It seems this FP is no longer reproduced in playground. Could you confirm?

@Nemo157
Copy link
Member Author

Nemo157 commented Jan 20, 2020

Yep, looks like it's fixed. Probably worth leaving open (and tagging easy) to add async fn testcases to the UI tests to make sure it doesn't regress.

@JohnTitor JohnTitor added good-first-issue These issues are a good way to get started with Clippy E-help-wanted Call for participation: Help is requested to fix this issue. E-needs-test Call for participation: writing tests and removed C-bug Category: Clippy is not doing the correct thing labels Jan 20, 2020
@JohnTitor
Copy link
Member

Sounds good! Marked as "good first issue".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-help-wanted Call for participation: Help is requested to fix this issue. E-needs-test Call for participation: writing tests good-first-issue These issues are a good way to get started with Clippy T-async-await Type: Issues related to async/await
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants