-
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
Avoid reporting string_lit_as_bytes for long strings #4233
Conversation
Ah, thank you. And I'm terribly sorry for not continuing the work. :( |
No problem! Thanks for the initial work. This is mostly your code. I've just ported it. |
clippy_lints/src/strings.rs
Outdated
@@ -173,6 +173,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes { | |||
); | |||
} else if callsite == expanded | |||
&& lit_content.as_str().chars().all(|c| c.is_ascii()) | |||
&& lit_content.as_str().len() <= 32 |
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.
It would be nice to extract the number into a const and add a small comment to it.
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.
How about 7d1a944?
Port of @jens1o code ([b76f939][jens1o_commit]) Fixes rust-lang#1208 [jens1o_commit]: jens1o@b76f939 Co-authored-by: Thiago Arrais <thiago.arrais@gmail.com>
445f7e1
to
7d1a944
Compare
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.
LGTM. cc @phansch?
@bors r=phansch,flip1995 thanks! |
📌 Commit 7d1a944 has been approved by |
Avoid reporting string_lit_as_bytes for long strings Port of @jens1o code ([b76f939][jens1o_commit]) Fixes #1208 [jens1o_commit]: jens1o@b76f939 <!-- Thank you for making Clippy better! We're collecting our changelog from pull request descriptions. If your PR only updates to the latest nightly, you can leave the `changelog` entry as `none`. Otherwise, please write a short comment explaining your change. If your PR fixes an issue, you can add "fixes #issue_number" into this PR description. This way the issue will be automatically closed when your PR is merged. If you added a new lint, here's a checklist for things that will be checked during review or continuous integration. - [ ] Followed [lint naming conventions][lint_naming] - [ ] Added passing UI tests (including committed `.stderr` file) - [ ] `cargo test` passes locally - [ ] Executed `util/dev update_lints` - [ ] Added lint documentation - [ ] Run `cargo fmt` Note that you can skip the above if you are just opening a WIP PR in order to get feedback. Delete this line and everything above before opening your PR --> changelog: bugfix for long strings as bytes
☀️ Test successful - checks-travis, status-appveyor |
Port of @jens1o code (b76f939)
Fixes #1208
changelog: bugfix for long strings as bytes