5

Fix 8128 by surechen · Pull Request #8133 · rust-lang/rust-clippy · GitHub

 2 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/8133
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

surechen commented on Dec 17, 2021

Fixes #8128

changelog: Fix error suggestion of skip(..).next() for immutable variable.

Copy link

Collaborator

rust-highfive commented on Dec 17, 2021

r? @flip1995

(rust-highfive has picked a reviewer for you, use r? to override)

Copy link

Contributor

Author

surechen commented on Dec 17, 2021

edited

I want to add a counter example. It runs correctly in playground. link
But the CI failed

Copy link

Member

@flip1995 flip1995 left a comment

The tests are failing, because rustfix can only apply suggestions produces by span_lint_and_sugg/span_suggestion. So you probably have to create a separate test file, that doesn't have the // run rustfix comment at the top.

Copy link

Contributor

Author

surechen commented 24 days ago

Hi, could you help me see this? Is it consistent with your modification suggestion? Thanks.
r? @xFrednet

Copy link

Member

@xFrednet xFrednet left a comment

Hi, could you help me see this? Is it consistent with your modification suggestion?

Sure, this is what I had in mind. I again looked into a way to check this differently, but I don't see a viable solution to get the information from the type of the self argument of skip. And I think this is fine, since @flip1995 didn't mention another solution in his first review.

I have two suggestions how the output could be a bit more readable, but otherwise this looks good to me. Thank you for the work upside_down_face

Copy link

Contributor

Author

surechen commented 23 days ago

Hi, could you help me see this? Is it consistent with your modification suggestion?

Sure, this is what I had in mind. I again looked into a way to check this differently, but I don't see a viable solution to get the information from the type of the self argument of skip. And I think this is fine, since @flip1995 didn't mention another solution in his first review.

I have two suggestions how the output could be a bit more readable, but otherwise this looks good to me. Thank you for the work upside_down_face

Done. Thanks.

Copy link

Member

@xFrednet xFrednet left a comment

Looks good to me! +1

Could you please squash your commits before the merge? If you want to keep the messages, you can squash the fix #8128 commits into one and all review commits into another one.

A related note: In Rust we usually avoid mentioning the issue in commit messages as that creates a new link in the issue with every rebase. I do see the advantage of mentioning it and use that feature in other projects as well. I think the idea is more to use a descriptive commit message that can be understood without opening an issue. We can also merge commits with such messages, and I'm happy to do so if you want to keep the messages. Just something I wanted to mention, this also depends on your personal style upside_down_face

Copy link

Contributor

Author

surechen commented 22 days ago

Looks good to me! +1

Could you please squash your commits before the merge? If you want to keep the messages, you can squash the fix #8128 commits into one and all review commits into another one.

A related note: In Rust we usually avoid mentioning the issue in commit messages as that creates a new link in the issue with every rebase. I do see the advantage of mentioning it and use that feature in other projects as well. I think the idea is more to use a descriptive commit message that can be understood without opening an issue. We can also merge commits with such messages, and I'm happy to do so if you want to keep the messages. Just something I wanted to mention, this also depends on your personal style upside_down_face

Done. Thank you very much.

Copy link

Member

xFrednet commented 22 days ago

LGTM, thank you for the update and quick replies! +1

@bors r+

Copy link

Contributor

bors commented 22 days ago

pushpin Commit 4ffd660 has been approved by xFrednet

Copy link

Contributor

bors commented 22 days ago

hourglass Testing commit 4ffd660 with merge bb7b6be...

bors

merged commit bb7b6be into

rust-lang:master 22 days ago

5 checks passed

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK