Do not suggest char literal for zero-length strings#92715
Merged
bors merged 1 commit intorust-lang:masterfrom Feb 9, 2022
Merged
Do not suggest char literal for zero-length strings#92715bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
klensy
reviewed
Jan 10, 2022
davidtwco
reviewed
Jan 16, 2022
Member
davidtwco
left a comment
There was a problem hiding this comment.
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
davidtwco
approved these changes
Jan 17, 2022
Member
|
@bors r+ rollup |
Member
|
Triage: @rustbot ready |
Member
|
Looks like bors just missed my comment and I didn't notice, oops: @bors r+ rollup |
Collaborator
|
📌 Commit 9622a42 has been approved by |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Feb 8, 2022
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.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 9, 2022
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.