Add suggestion to .to_owned() used on Cow when borrowing#154646
Open
m4rch3n1ng wants to merge 2 commits intorust-lang:mainfrom
Open
Add suggestion to .to_owned() used on Cow when borrowing#154646m4rch3n1ng wants to merge 2 commits intorust-lang:mainfrom
.to_owned() used on Cow when borrowing#154646m4rch3n1ng wants to merge 2 commits intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
1ddf88f to
f08989c
Compare
This comment has been minimized.
This comment has been minimized.
f08989c to
41f7c2d
Compare
Collaborator
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
Contributor
|
(just a drive-by comment) in order for a code block inside Details to work correctly, you need to leave an empty line before and after the code block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #144792
supersedes #144925 with the review comments addressed
the tests suggested from @Kivooeo from #144925 (comment) didn't work entirely, because these tests failed due to error
[E0308]mismatched types, which actually already provides a suggestion, that actually makes the code compile:now this suggestion is of course not good or efficient code, but via clippy with
-Wclippy::nurserylint group you can actually get to the correct code, so i don't think this is too much of an issue:the clippy suggestions
the actual error that we are looking for is error
[E0515], cannot return value referencing local variable, which was only present in the original issue due to automatic type inference assuming you want to return a clonedCow<'_, str>, which is of course not possible. this is why i took the original test functions and turned them into closures, where it's less obvious that it's trying to return the wrong type.r? davidtwco
(because you reviewed the last attempt)
(also, let me know if i should squash this down to one commit and add myself as the co-contributor)