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

Add inefficient_to_string lint #4683

Merged
merged 4 commits into from
Oct 18, 2019
Merged

Conversation

HMPerson1
Copy link
Contributor

Closes #4586

changelog: Add inefficient_to_string lint, which checks for calling to_string on &&str, which would bypass the str's specialization

@phansch phansch added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 17, 2019
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.

Everything else LGTM.

@@ -0,0 +1,31 @@
#![deny(clippy::inefficient_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.

Can you add // run-rustfix to make this a rustfix test?

@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 Oct 17, 2019
@Manishearth
Copy link
Member

(You'll also need to update the test expectations)

Co-Authored-By: Manish Goregaokar <manishsmail@gmail.com>
@Manishearth
Copy link
Member

@bors r+

thanks!

@bors
Copy link
Collaborator

bors commented Oct 17, 2019

📌 Commit 2106a23 has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Oct 17, 2019

⌛ Testing commit 2106a23 with merge 14a0f36...

bors added a commit that referenced this pull request Oct 17, 2019
Add `inefficient_to_string` lint

Closes #4586

changelog: Add `inefficient_to_string` lint, which checks for calling `to_string` on `&&str`, which would bypass the `str`'s specialization
@bors
Copy link
Collaborator

bors commented Oct 18, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: Manishearth
Pushing 14a0f36 to master...

@bors bors merged commit 2106a23 into rust-lang:master Oct 18, 2019
@HMPerson1 HMPerson1 deleted the inefficient_to_string branch October 18, 2019 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint against calling to_string() on &&str, &&String, etc.
5 participants