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

Removing RHS snippet from SHADOW_UNRELATED message. #5788

Merged
merged 1 commit into from
Jul 15, 2020
Merged

Removing RHS snippet from SHADOW_UNRELATED message. #5788

merged 1 commit into from
Jul 15, 2020

Conversation

Leulz
Copy link
Contributor

@Leulz Leulz commented Jul 13, 2020

Fixes #5703

I am not sure if I reinvented the wheel here, but I could not really find a snippet function that did this truncation, so I created the function. Please tell me if there was a more obvious way to do this, I am new here. 😄

changelog: Truncates multi-line RHS in shadow_unrelated message if it has more than 5 lines.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @yaahc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 13, 2020
@flip1995
Copy link
Member

r? @flip1995

@rust-highfive rust-highfive assigned flip1995 and unassigned yaahc Jul 13, 2020
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need this. Especially for the shadow_unrelated lint, I don't think the span of the expression that is assigned to the shadowing binding doesn't help at all, IMO. So removing this snippet would be the better solution in this case.

If multi-line snippets are involved there almost always is a possibility to add a hint/note/suggestion through the rustc diag interface, which truncates multi-line snippets automatically.

clippy_lints/src/shadow.rs Outdated Show resolved Hide resolved
@flip1995 flip1995 added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Jul 13, 2020
@Leulz
Copy link
Contributor Author

Leulz commented Jul 15, 2020

Thanks for the review, @flip1995! Sorry I took so long to get back to this PR, but I've finally made the changes you suggested. Much easier than what I had initially thought was needed. 😄

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase onto master, to get rid of the merge commits. Otherwise this is good to go.

@Leulz Leulz changed the title Implementing snippet_truncated for multi-line spans. Removing RHS snippet from SHADOW_UNRELATED message. Jul 15, 2020
@Leulz
Copy link
Contributor Author

Leulz commented Jul 15, 2020

Rebase done, but I'm not quite sure why that check failed. 🤔

@flip1995
Copy link
Member

That failure is unrelated, don't worry about it.

@flip1995 flip1995 added S-waiting-on-bors Status: The marked PR was approved and is only waiting bors and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Jul 15, 2020
@flip1995
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Jul 15, 2020

📌 Commit a064045 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Jul 15, 2020

⌛ Testing commit a064045 with merge 9349441...

@bors
Copy link
Contributor

bors commented Jul 15, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 9349441 to master...

@bors bors merged commit 9349441 into rust-lang:master Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: The marked PR was approved and is only waiting bors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

shadow_unrelated puts entire RHS of shadow var into message
5 participants