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

Added lint str_to_string #6333

Merged
merged 1 commit into from
Nov 25, 2020
Merged

Added lint str_to_string #6333

merged 1 commit into from
Nov 25, 2020

Conversation

PunitLodha
Copy link
Contributor

@PunitLodha PunitLodha commented Nov 14, 2020

Please write a short comment explaining your change (or "none" for internal only changes)
changelog: un-deprecate [str_to_string] and [string_to_string] and introduce them as restriction lints again.
Fixes #5610
Added new lint:- str_to_string
r? @flip1995

@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 @flip1995 (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 Nov 14, 2020
@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 Nov 14, 2020
@PunitLodha
Copy link
Contributor Author

PunitLodha commented Nov 15, 2020

I have commented out some lines, you can check and let me know if i should remove those lines.
Two tests are failing,
failures:
[ui] ui/deprecated.rs
[ui] ui/deprecated_old.rs
Should i update these too?

Also running cargo dev update lints, adds store.register_removed to src/lib.rs for str_to_string and string_to_string. How can i fix this?

Copy link
Contributor

@ThibsG ThibsG left a comment

Choose a reason for hiding this comment

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

Only some NITs, thanks for working on this.
On a general note, do not hesitate to remove the lines instead of commenting them, I think it is more visual and easy to review removed lines 😄

Also, you can update ui/deprecated.rs and ui/deprecated_old.rs.

Also running cargo dev update lints, adds store.register_removed to src/lib.rs for str_to_string and string_to_string. How can i fix this?

That's weird, I'd say removing stuff from clippy_lints/src/lib.rs would do the trick, but maybe there is some mechanism for removed lints I am not aware. If I found something I'll let you know.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
clippy_lints/src/deprecated_lints.rs Outdated Show resolved Hide resolved
clippy_lints/src/lib.rs Outdated Show resolved Hide resolved
clippy_lints/src/lib.rs Outdated Show resolved Hide resolved
clippy_lints/src/string_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/str_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/str_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/string_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/string_to_string.rs Outdated Show resolved Hide resolved
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.

impl LGTM overall. Some code cleanup left to do.

Also running cargo dev update lints, adds store.register_removed to src/lib.rs for str_to_string and string_to_string. How can i fix this?

That was, because you only commented out the deprecate_clippy_lint! macros, instead of removing them. cargo dev update_lints only searches files for strings and does not parse Rust code.

Comment on lines 309 to 310
mod str_to_string;
mod string_to_string;
Copy link
Member

Choose a reason for hiding this comment

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

Those to lints should be in the same module. There is already a strings module, so you can put these lints there.

And while you're there, you could combine all the LateLintPass implementations in the strings module into one. But please do this in an extra commit. (Or leave it for a later PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding the two lints to the strings.rs file would do it? Also by combining all the LateLintPass implementations do you mean that there should be only one of it for all the lints in string.rs file?

Copy link
Member

Choose a reason for hiding this comment

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

do you mean that there should be only one of it for all the lints in string.rs file?

Yes, exactly.

Adding the two lints to the strings.rs file would do it?

You also have to copy over the code in the LateLintPass impls, but you can reuse the LateLintPass impl in the other module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think combining all the LateLintPass implementations could be done in a new PR

tests/ui/str_to_string.rs Outdated Show resolved Hide resolved
tests/ui/string_to_string.rs Outdated Show resolved Hide resolved
@bors
Copy link
Collaborator

bors commented Nov 20, 2020

☔ The latest upstream changes (presumably #6351) made this pull request unmergeable. Please resolve the merge conflicts.

Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@PunitLodha
Copy link
Contributor Author

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Nov 25, 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.

Some formulations. Remember to update the reference files after those changes.

Also, please squash your commits.

clippy_lints/src/strings.rs Outdated Show resolved Hide resolved
clippy_lints/src/strings.rs Outdated Show resolved Hide resolved
clippy_lints/src/strings.rs Outdated Show resolved Hide resolved
clippy_lints/src/strings.rs Outdated Show resolved Hide resolved
@PunitLodha
Copy link
Contributor Author

Made the requested changes, and squashed to a single commit

@flip1995 flip1995 changed the title [WIP] Added lint str_to_string Added lint str_to_string Nov 25, 2020
@flip1995
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Nov 25, 2020

📌 Commit 2345ef5 has been approved by flip1995

@bors
Copy link
Collaborator

bors commented Nov 25, 2020

⌛ Testing commit 2345ef5 with merge ae57785...

@bors
Copy link
Collaborator

bors commented Nov 25, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider reinstating str_to_string and string_to_string
6 participants