Add new lint for byte char slices#10155
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon. Please see the contribution instructions for more information. |
|
Potentially also @Alexendoo ? (Since you 'approved' the idea) |
4ca3bfb to
2e49b11
Compare
|
|
☔ The latest upstream changes (presumably #10206) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@TheNeikos I think we can merge this after a rebase. |
|
Hey @TheNeikos this is a ping from triage. Would you mind rebasing this PR? @rustbot author |
27bfb1b to
e252f22
Compare
|
I've just rebased, since that seamed to be the last thing holding this back. I'll create an FCP for this. |
|
☔ The latest upstream changes (presumably #12873) made this pull request unmergeable. Please resolve the merge conflicts. |
This patch adds a new lint that checks for potentially harder to read byte char slices: `&[b'a', b'b']` and suggests to replace them with the easier to read `b"ab"` form. Signed-Off-By: Marcel Müller <m.mueller@ifm.com> Co-authored-by: Matthias Beyer <matthias.beyer@ifm.com> Use iterator to skip validation Signed-off-by: Marcel Müller <m.mueller@ifm.com> Suggested-by: Alex Macleod <alex@macleod.io> Convert quote escapes to proper form Signed-off-by: Marcel Müller <m.mueller@ifm.com> Add more convertable test cases Signed-off-by: Marcel Müller <m.mueller@ifm.com>
e252f22 to
88c4a22
Compare
|
I'd say the FCP is done. The only feedback was to rename the lint, which I've done. @Manishearth Can we r+ it, or do you want to check something else? |
|
Yeah that sounds good! @bors r+ |
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
|
I think this lint has a false positive The suggestion seems blatantly wrong, as the code doesn't even compile if I follow it: |
|
@danielocfb The arrows in the diagnostic cover the whole function argument, so clippy is suggesting |
|
Ah my bad. Sorry for the noise then. |
This patch adds a new lint that checks for potentially harder to read byte char slices:
&[b'a', b'b']and suggests to replace them with the easier to readb"ab"form.Fixes #10147
changelog: new lint: [
byte_char_slices]#10155