-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Check when from_utf8
is called from sliced byte array from string
#6134
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @phansch (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
from_utf8
is called from sliced byte array from string
4177a96
to
0336d71
Compare
☔ The latest upstream changes (presumably #6117) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
0336d71
to
7813ec2
Compare
ping @phansch |
1 similar comment
ping @phansch |
d58c1e7
to
5da2b18
Compare
Hey @llogiq, would you mind taking over the review of this new lint? (I'm kind of doing an open source break for a bit with all the things going on right now and removed myself from the review rotation) |
Sure thing. I'll see if I can find the time to catch up over the weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks mostly good, I only left a few small nitpicky comments. Please let me know if you want to tackle the suggestion and if so, whether you need any help.
clippy_lints/src/strings.rs
Outdated
if method_names.len() == 1; | ||
if method_names[0] == sym!(as_bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be if &[sym!(as_bytes)] == method_names;
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not possible since method_names
is a vector and the other side is a fixed size array &[something, 1]
, I may be wrong, but I was unable to find a way to accomplish such thing.
Any tips ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmm...perhaps &method_names
or even &method_names[..]
? Sorry, I don't have the time to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intention is to use a slice pattern, it should be an if let
d5a104c
to
f2d32b3
Compare
Is it possible to kindly add the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing i found that may improve the lint, but no blocker.
Hey, @patrickelectric I think we can merge this if you change the lint group to |
f2d32b3
to
e5fa0c1
Compare
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
e5fa0c1
to
bc27d14
Compare
Hi @llogiq thank you for your review and catch up, I believe that everything requested was done, let me know if otherwise. |
Thank you! @bors r+ |
📌 Commit bc27d14 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Please keep the line below
changelog: Fix #5487: Add linter to check when
from_utf8
is called from sliced byte array from string.