-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.T-langRelevant to the language teamRelevant to the language team
Description
PR #59825 added a impl From<&String> for String
.
While perusing the rustc
source, I am now seeing instances of String
values being constructed and then passed via-reference into a function that wants a String
. These would not have compiled without the change added by PR #59825.
It might be worthwhile to try to make a lint that detects the last use of a String
that is then being used as an argument to &
which is then itself passed to this conversion method (which effectively hides the clone taking place.
(You can see discussion of the hidden clone on #59827; I'm not seeking debate on the merits of PR #59825. I just am wondering if we could easily highlight the unnecessary clones via a lint.)
estebank, mibac138 and messense
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.T-langRelevant to the language teamRelevant to the language team