-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Do not suggest char literal for zero-length strings #92715
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
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 great, apologies for the delay in reviewing, I've left one comment in the existing thread, after that we can merge this :)
9ee4d3d
to
49fd8ee
Compare
49fd8ee
to
9622a42
Compare
@bors r+ rollup |
Triage: @rustbot ready |
Looks like bors just missed my comment and I didn't notice, oops: @bors r+ rollup |
📌 Commit 9622a42 has been approved by |
Do not suggest char literal for zero-length strings PR rust-lang#92507 adds a hint to switch to single quotes when a char is expected and a single-character string literal is provided. The check to ensure the string literal is one character long missed the 0-char case, and would incorrectly offer the hint. This PR adds the missing check, and a test case to confirm the new behavior.
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#91950 (Point at type when a `static` `#[global_allocator]` doesn't `impl` `GlobalAlloc`) - rust-lang#92715 (Do not suggest char literal for zero-length strings) - rust-lang#92917 (Don't constrain projection predicates with inference vars in GAT substs) - rust-lang#93206 (Use `NtCreateFile` instead of `NtOpenFile` to open a file) - rust-lang#93732 (add fut/back compat tests for implied trait bounds) - rust-lang#93764 (:arrow_up: rust-analyzer) - rust-lang#93767 (deduplicate `lcnr` in mailmap) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
PR #92507 adds a hint to switch to single quotes when a char is expected and a single-character string literal is provided.
The check to ensure the string literal is one character long missed the 0-char case, and would incorrectly offer the hint.
This PR adds the missing check, and a test case to confirm the new behavior.