rust-lang / rust-lang/rust-clippy
single_char_pattern doesn't recognize scape sequences
Open
Nobody has claimed this yet.
L-suggestion
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Example (playground):
string.find("\"");
errors with
|
3 | string.find("\"");
| ^^^^ help: try using a char instead: `'\"'`
|
= note: #[warn(single_char_pattern)] on by default
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#single_char_pattern
However, the appropriate char to use is '"' without the escape: \.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the single_char_pattern warning with the Rust example in the linked playground, then locate the lint's handling of escaped string literals. The issue does not name a source file or test; done means the suggested char literal is '"' without the unnecessary escape and the warning remains correct for other cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100