forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix escaping problem in
write_literal
and print_literal
lint sugg…
…estion (rust-lang#13990) fix rust-lang#13959 The current implementation of the `write_literal` and `print_literal` lint performs escaping for the second argument of `write!` ,`writeln!`, `print!` and `println!` of the suggestion by first replacing `"` with `\"`, and then replacing `\` with `\\`. Performing these replacements in this order may lead to unnecessary backslashes being added if the original code contains `"` (e.g. `"` -> `\\"`), potentially resulting in a suggestion that causes the code to fail to compile. In the issue mentioned above, it’s suggested to use raw strings as raw strings, but implementing this would require an ad-hoc change to the current implementation, so it has been deferred. (I'll implement this in another PR) changelog: [`write_literal`]: fix incorrect escaping of suggestions changelog: [`print_literal`]: fix incorrect escaping of suggestions
- Loading branch information
Showing
7 changed files
with
137 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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