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 unnecessary_to_owned false positive #9424

Merged
merged 1 commit into from Sep 4, 2022
Merged

Fix unnecessary_to_owned false positive #9424

merged 1 commit into from Sep 4, 2022

Conversation

ghost
Copy link

@ghost ghost commented Sep 3, 2022

Fixes #9351.

Note that this commit reworks that fix for #9317. The change
is to check that the type implements AsRef<str> before regarding
to_string as an equivalent of to_owned. This was suggested
by Jarcho in the #9317 issue comments.

The benefit of this is that it moves some complexity out of
check_other_call_arg and simplifies the module as a whole.

changelog: FP: [unnecessary_to_owned]: No longer lints, if type change would cause errors in the caller function

Fixes #9351.

Note that this commit reworks that fix for #9317. The change
is to check that the type implements `AsRef<str>` before regarding
`to_string` as an equivalent of `to_owned`. This was suggested
by Jarcho in the #9317 issue comments.

The benefit of this is that it moves some complexity out of
`check_other_call_arg` and simplifies the module as a whole.
@rust-highfive
Copy link

r? @xFrednet

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 3, 2022
Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and lintcheck also agrees with these changes 🙃

@xFrednet
Copy link
Member

xFrednet commented Sep 4, 2022

Thank you for the update. I've adjusted the changelog entry a bit :)

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 4, 2022

📌 Commit 750a2d5 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Sep 4, 2022

⌛ Testing commit 750a2d5 with merge 46b7cb6...

@bors
Copy link
Collaborator

bors commented Sep 4, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing 46b7cb6 to master...

@bors bors merged commit 46b7cb6 into rust-lang:master Sep 4, 2022
@ghost ghost deleted the fix-9351-4 branch September 5, 2022 12:03
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.

unnecessary_to_owned doesn't take type changes into account
3 participants