Do not suggest char literal for zero-length strings by chordtoll · Pull Request #92715 · rust-lang/rust (original) (raw)

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.