aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-05 19:16:57 +0100
committerGitHub <[email protected]>2021-06-05 19:16:57 +0100
commitb68407fab874d8f580976b87090a45de4d5e29ff (patch)
treee336458e67cef26e39f2d4b900f31d3716b1b832 /xtask/src
parentad9234fef2a90105448214255669fb46a382c3a5 (diff)
parentfc06058a76d449decf3bf0e66619c4e9d73f3a50 (diff)
Merge #9150
9150: Unescape generated clippy lints r=lnicola a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
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 a28b6cb59..7d78d0d04 100644
--- a/xtask/src/codegen/gen_lint_completions.rs
+++ b/xtask/src/codegen/gen_lint_completions.rs
@@ -109,6 +109,10 @@ struct ClippyLint {
109 id: String, 109 id: String,
110} 110}
111 111
112fn unescape(s: &str) -> String {
113 s.replace(r#"\""#, "").replace(r#"\n"#, "\n").replace(r#"\r"#, "")
114}
115
112fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> { 116fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> {
113 let file_content = read_file(path)?; 117 let file_content = read_file(path)?;
114 let mut clippy_lints: Vec<ClippyLint> = vec![]; 118 let mut clippy_lints: Vec<ClippyLint> = vec![];
@@ -135,6 +139,7 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> {
135 .strip_prefix(prefix_to_strip) 139 .strip_prefix(prefix_to_strip)
136 .expect("should be prefixed by what it does") 140 .expect("should be prefixed by what it does")
137 .strip_suffix(suffix_to_strip) 141 .strip_suffix(suffix_to_strip)
142 .map(unescape)
138 .expect("should be suffixed by comma") 143 .expect("should be suffixed by comma")
139 .into(); 144 .into();
140 } 145 }