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

Suggest from_utf8_unchecked in const contexts #8612

Merged

Conversation

SabrinaJewson
Copy link
Contributor

Unfortunately I couldn't figure out how to check whether a given expression is in an unsafe context or not, so I just unconditionally emit the wrapping unsafe {} block in the suggestion. If there is an easy way to get it to work better then I would love to hear it.

changelog: Suggest from_utf8_unchecked instead of from_utf8 in const contexts for [`transmute_bytes_to_str`]

refs: #8379

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 30, 2022
@bors
Copy link
Collaborator

bors commented Mar 30, 2022

☔ The latest upstream changes (presumably #8610) made this pull request unmergeable. Please resolve the merge conflicts.

@SabrinaJewson SabrinaJewson force-pushed the suggest-from-utf8-unchecked-in-const branch from baa272b to 7a80c23 Compare March 30, 2022 20:49
@Jarcho
Copy link
Contributor

Jarcho commented Mar 31, 2022

transmute already requires an unsafe block so you don't need to suggest adding one.

@SabrinaJewson
Copy link
Contributor Author

Oh haha, I don't know how I didn't realize that 😅 . Thanks for pointing it out.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Only one comment, LGTM otherwise.

clippy_lints/src/transmute/transmute_ref_to_ref.rs Outdated Show resolved Hide resolved
Co-authored-by: Philipp Krones <hello@philkrones.com>
@flip1995
Copy link
Member

flip1995 commented Apr 6, 2022

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Apr 6, 2022

📌 Commit 41ef4f7 has been approved by flip1995

@bors
Copy link
Collaborator

bors commented Apr 6, 2022

⌛ Testing commit 41ef4f7 with merge cf1e2e9...

@bors
Copy link
Collaborator

bors commented Apr 6, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing cf1e2e9 to master...

@bors bors merged commit cf1e2e9 into rust-lang:master Apr 6, 2022
@SabrinaJewson SabrinaJewson deleted the suggest-from-utf8-unchecked-in-const branch April 6, 2022 09:49
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.

5 participants