about summary refs log tree commit diff
path: root/xtask/src
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2021-06-05 19:14:53 +0200
committerLukas Wirth <lukastw97@gmail.com>2021-06-05 19:14:53 +0200
commitfc06058a76d449decf3bf0e66619c4e9d73f3a50 (patch)
tree91b05e5c033d4697895b0de4691dad6deb00c986 /xtask/src
parent5092d8c1ae50010d35f6860b6420a69ddcd9ca45 (diff)
downloadrust-fc06058a76d449decf3bf0e66619c4e9d73f3a50.tar.gz
rust-fc06058a76d449decf3bf0e66619c4e9d73f3a50.zip
Unescape generated clippy lints
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/codegen/gen_lint_completions.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/xtask/src/codegen/gen_lint_completions.rs b/xtask/src/codegen/gen_lint_completions.rs
index a28b6cb59c6..7d78d0d04fb 100644
--- a/xtask/src/codegen/gen_lint_completions.rs
+++ b/xtask/src/codegen/gen_lint_completions.rs
@@ -109,6 +109,10 @@ struct ClippyLint {
     id: String,
 }
 
+fn unescape(s: &str) -> String {
+    s.replace(r#"\""#, "").replace(r#"\n"#, "\n").replace(r#"\r"#, "")
+}
+
 fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> {
     let file_content = read_file(path)?;
     let mut clippy_lints: Vec<ClippyLint> = vec![];
@@ -135,6 +139,7 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> {
                 .strip_prefix(prefix_to_strip)
                 .expect("should be prefixed by what it does")
                 .strip_suffix(suffix_to_strip)
+                .map(unescape)
                 .expect("should be suffixed by comma")
                 .into();
         }