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

Implement lint for inherent to_string() method. #4259

Merged
merged 3 commits into from
Jul 17, 2019
Merged

Implement lint for inherent to_string() method. #4259

merged 3 commits into from
Jul 17, 2019

Conversation

Darth-Revan
Copy link
Contributor

@Darth-Revan Darth-Revan commented Jul 6, 2019

Fixes #4247

changelog: Implement two new lints: inherent_to_string and inherent_to_string_shadow_display

  1. Emits a warning if a type implements an inherent method to_string(&self) -> String
  2. Emits an error if a type implements an inherent method to_string(&self) -> String and also implements the Display trait

@Darth-Revan
Copy link
Contributor Author

The CI build currently fails due to the removal of hir::ExprKind::While. The build should succeed again after PR #4258 has been merged.

@flip1995 flip1995 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 9, 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.

Great work over all! Just a few NITs.

clippy_lints/src/inherent_to_string.rs Show resolved Hide resolved
clippy_lints/src/inherent_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/inherent_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/inherent_to_string.rs Outdated Show resolved Hide resolved
tests/ui/inherent_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/inherent_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/inherent_to_string.rs Outdated Show resolved Hide resolved
clippy_lints/src/inherent_to_string.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 14, 2019
@flip1995 flip1995 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 Jul 17, 2019
@flip1995
Copy link
Member

Thanks! (I just removed the merge commits by rebasing)

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 17, 2019

📌 Commit b7145fb has been approved by flip1995

@bors
Copy link
Collaborator

bors commented Jul 17, 2019

⌛ Testing commit b7145fb with merge 5dfb5ad...

bors added a commit that referenced this pull request Jul 17, 2019
Implement lint for inherent to_string() method.

Fixes #4247

changelog: Implement two new lints: `inherent_to_string` and `inherent_to_string_shadow_display`

1) Emits a warning if a type implements an inherent method `to_string(&self) -> String`
2) Emits an error if a type implements an inherent method `to_string(&self) -> String` and also implements the `Display` trait
@bors
Copy link
Collaborator

bors commented Jul 17, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: flip1995
Pushing 5dfb5ad 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.

Lint against declaring fn to_string(&self) -> String
3 participants