-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Extend implicit_clone
to handle to_string
calls
#14177
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
base: master
Are you sure you want to change the base?
Conversation
72eccf1
to
a1615be
Compare
@y21 Sorry for the force pushes. I think it should be good now. |
a1615be
to
cb609f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. I opened a thread on Zulip to give people a chance and some time to comment on this since this involves a deprecation
nit: |
656f7a5
to
daa7c5f
Compare
Hmm. Lines 48 to 52 in f83c94c
|
From what I can tell, driver.sh requires a stderr file with a certain structure. I picked the first one I could find that worked. That happened to be |
Yeah, I think that should be fine. Looking at git blame for that line, looks like the lint name on that line has changed a couple of times before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and the thread on Zulip got a bunch of positive reactions so we should be fine here with deprecating/merging the lint.
However, going to tag @flip1995 here for the change in .github/driver.sh
. It looks correct to me, but just making sure because he's said he wants to be notified of any changes that affect CI.
Yeah, detecting However, I don't think special-casing |
f8ad6f6
to
0b85f4d
Compare
Scratch that. I am undoing the following commits. I explain why below.
#14396 matches on both method calls and calls to type-relative paths. But the code that calls I think it would be desirable to have So I find the present situation unfortunate, but I guess it's what we've got. |
@y21 Could I impose on you to please try to merge this? |
One issue with this split as it is now is that we get two warnings with different suggestions on the same code, I still don't think that we really need the |
b3e48ef
to
46f720c
Compare
Sorry, you mentioned So this PR is back to deprecating A quick note: to avoid overlapping warnings between
Sorry to give you more code to review. |
46f720c
to
12dff35
Compare
The force push was to make one comment slightly less verbose. |
This comment has been minimized.
This comment has been minimized.
12dff35
to
d80c373
Compare
This comment has been minimized.
This comment has been minimized.
d80c373
to
9a85c45
Compare
This comment has been minimized.
This comment has been minimized.
9a85c45
to
d36e477
Compare
This comment has been minimized.
This comment has been minimized.
d36e477
to
c6cc428
Compare
This comment has been minimized.
This comment has been minimized.
c6cc428
to
8ab047e
Compare
This comment has been minimized.
This comment has been minimized.
8ab047e
to
b09d9d6
Compare
Hey, @y21. Is anything holding this PR back? |
Is this actually needed? I'm still not entirely convinced that even moving the logic that was added in that PR elsewhere is worth it. My suggestion was to just deprecate the My reasoning is that Let's take this newly added test case from If we just deprecate the lint entirely and move only the So even without this extra logic, we end up with the same ideal code, it just takes two clippy runs instead of one to get there, but IMHO this is a natural interaction between two lints (progressively refactoring it further). I think rustfix also handles this pretty well and applies multiple consecutive So, rephrasing, just to be clear, my suggestion would be:
Which is essentially what the PR was doing from the start, I believe. WDYT? It would also simplify the PR a bit. If you do think that the extra logic from the PR to go to the ideal suggestion directly instead of having it naturally handled by the two lints is really worth keeping, I'm also ok accepting the changes you've proposed (I merely wanted to elaborate on what exactly I meant). It's also possible that my suggestion doesn't work because I've missed a subtle detail |
To be sure I understand, what you're suggesting would amount to reverting #14396. Is that right? If so, I'm not sure my opinion matters. Should we involve the author and reviewers of #14396? |
Put another way, merge
string_to_string
intoimplicit_clone
, as suggested here: #14173 (comment)Note: I wrote this comment:
rust-clippy/clippy_lints/src/methods/implicit_clone.rs
Lines 43 to 45 in 6cdb7f6
Here is the context for why I wrote it: #7978 (comment)
Regardless, it's probably time for the comment to go away. Extending
implicit_clone
to handleto_string
calls yields many hits within Clippy's codebase.changelog: extend
implicit_clone
to handleto_string
calls