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

Extend unnecessary_to_owned to handle Borrow trait in map types #12324

Merged
merged 3 commits into from Feb 21, 2024

Conversation

GuillaumeGomez
Copy link
Member

Fixes #8088.

Alternative to #12315.

r? @y21

changelog: Extend unnecessary_to_owned to handle Borrow trait in map types

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 20, 2024
@GuillaumeGomez
Copy link
Member Author

It allowed to detect two cases just in clippy, nice. :)

Copy link
Member

@y21 y21 left a comment

Choose a reason for hiding this comment

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

This looks like a nice addition to the lint 👍 Makes sense to me to have this here.

clippy_lints/src/min_ident_chars.rs Outdated Show resolved Hide resolved
clippy_lints/src/methods/unnecessary_to_owned.rs Outdated Show resolved Hide resolved
clippy_lints/src/methods/unnecessary_to_owned.rs Outdated Show resolved Hide resolved
tests/ui/unnecessary_to_owned.rs Show resolved Hide resolved
@GuillaumeGomez
Copy link
Member Author

Updated!

Copy link
Member

@y21 y21 left a comment

Choose a reason for hiding this comment

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

Just two more things and then I think it LGTM

tests/ui/unnecessary_to_owned.rs Show resolved Hide resolved
@GuillaumeGomez
Copy link
Member Author

Updated!

@GuillaumeGomez
Copy link
Member Author

Reverted the match.

@y21
Copy link
Member

y21 commented Feb 21, 2024

Looks great now, thanks! :)

@bors r+

@bors
Copy link
Collaborator

bors commented Feb 21, 2024

📌 Commit 635acb6 has been approved by y21

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Feb 21, 2024

⌛ Testing commit 635acb6 with merge a248330...

bors added a commit that referenced this pull request Feb 21, 2024
Extend `unnecessary_to_owned` to handle `Borrow` trait in map types

Fixes #8088.

Alternative to #12315.

r? `@y21`

changelog: Extend `unnecessary_to_owned` to handle `Borrow` trait in map types
@bors
Copy link
Collaborator

bors commented Feb 21, 2024

💔 Test failed - checks-action_test

@y21
Copy link
Member

y21 commented Feb 21, 2024

@bors retry

@bors
Copy link
Collaborator

bors commented Feb 21, 2024

⌛ Testing commit 635acb6 with merge 250fd09...

@bors
Copy link
Collaborator

bors commented Feb 21, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: y21
Pushing 250fd09 to master...

@bors bors merged commit 250fd09 into rust-lang:master Feb 21, 2024
5 checks passed
@GuillaumeGomez GuillaumeGomez deleted the useless_allocation2 branch February 21, 2024 21:53
@GuillaumeGomez
Copy link
Member Author

Thanks for the great suggestions!

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.

[ER] Useless str -> String allocation
4 participants