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

Fix false positive in string_add. #4880

Merged
merged 2 commits into from
Dec 5, 2019
Merged

Fix false positive in string_add. #4880

merged 2 commits into from
Dec 5, 2019

Conversation

daxpedda
Copy link
Contributor

@daxpedda daxpedda commented Dec 4, 2019

clippy::string_add was popping up in macros.
I'm not sure what clippy's general direction is in these matters, but I can change it to be external macros only too.


changelog: Fix false positives for string_add in macro expansions.

@phansch
Copy link
Member

phansch commented Dec 5, 2019

I'm not sure what clippy's general direction is in these matters

In general we want to always avoid linting in external macros. For user-defined macros it depends on the lint. Since macros can become very complex there can be weird issues sometimes.

What does this lint report if it's triggering in a user-defined macro?

@daxpedda
Copy link
Contributor Author

daxpedda commented Dec 5, 2019

It reports if it does string additions with an arithmetic operator instead of push_str.
Basically telling u to do s.push_str("asd") instead of s + "asd".

The lint works perfectly fine in user-defined macros, so there's no issue there. I suppose I should change it to checking in external macros only.

Is there a way to test external macros?

EDIT: Found out how to test for external macros.

@daxpedda
Copy link
Contributor Author

daxpedda commented Dec 5, 2019

Changed it to check only in external macros, as the lint was behaving as intended in internal macros.

@phansch
Copy link
Member

phansch commented Dec 5, 2019

@bors r+ thanks!

@bors
Copy link
Contributor

bors commented Dec 5, 2019

📌 Commit 946961d has been approved by phansch

@bors
Copy link
Contributor

bors commented Dec 5, 2019

⌛ Testing commit 946961d with merge ff1607e...

bors added a commit that referenced this pull request Dec 5, 2019
Fix false positive in `string_add`.

`clippy::string_add` was popping up in macros.
I'm not sure what clippy's general direction is in these matters, but I can change it to be external macros only too.

---

changelog: Fix false positives for `string_add` in macro expansions.
@bors
Copy link
Contributor

bors commented Dec 5, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: phansch
Pushing ff1607e to master...

@bors bors merged commit 946961d into rust-lang:master Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants