aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-04 18:03:45 +0100
committerLukas Wirth <[email protected]>2021-06-04 18:10:52 +0100
commit0c89f38378c2110cf6c080a5dc837bf7731fef5c (patch)
tree97955f808060af829122b39e07a80fbd9622db18 /xtask/src
parent0b9ba4977ef5b81747c8e5c623009497f9d7c99a (diff)
Replace `-` with `_` in generated lint names
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/codegen/gen_lint_completions.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/xtask/src/codegen/gen_lint_completions.rs b/xtask/src/codegen/gen_lint_completions.rs
index b797067cd..a28b6cb59 100644
--- a/xtask/src/codegen/gen_lint_completions.rs
+++ b/xtask/src/codegen/gen_lint_completions.rs
@@ -52,6 +52,7 @@ fn generate_lint_descriptor(buf: &mut String) -> Result<()> {
52 buf.push('\n'); 52 buf.push('\n');
53 let mut lints = stdout[start_lints..end_lints] 53 let mut lints = stdout[start_lints..end_lints]
54 .lines() 54 .lines()
55 .skip(1)
55 .filter(|l| !l.is_empty()) 56 .filter(|l| !l.is_empty())
56 .map(|line| { 57 .map(|line| {
57 let (name, rest) = line.trim().split_once(char::is_whitespace).unwrap(); 58 let (name, rest) = line.trim().split_once(char::is_whitespace).unwrap();
@@ -60,15 +61,19 @@ fn generate_lint_descriptor(buf: &mut String) -> Result<()> {
60 (name.trim(), Cow::Borrowed(description.trim())) 61 (name.trim(), Cow::Borrowed(description.trim()))
61 }) 62 })
62 .collect::<Vec<_>>(); 63 .collect::<Vec<_>>();
63 lints.extend(stdout[start_lint_groups..end_lint_groups].lines().filter(|l| !l.is_empty()).map( 64 lints.extend(
64 |line| { 65 stdout[start_lint_groups..end_lint_groups].lines().skip(1).filter(|l| !l.is_empty()).map(
65 let (name, lints) = line.trim().split_once(char::is_whitespace).unwrap(); 66 |line| {
66 (name.trim(), format!("lint group for: {}", lints.trim()).into()) 67 let (name, lints) = line.trim().split_once(char::is_whitespace).unwrap();
67 }, 68 (name.trim(), format!("lint group for: {}", lints.trim()).into())
68 )); 69 },
70 ),
71 );
69 72
70 lints.sort_by(|(ident, _), (ident2, _)| ident.cmp(ident2)); 73 lints.sort_by(|(ident, _), (ident2, _)| ident.cmp(ident2));
71 lints.into_iter().for_each(|(name, description)| push_lint_completion(buf, name, &description)); 74 lints.into_iter().for_each(|(name, description)| {
75 push_lint_completion(buf, &name.replace("-", "_"), &description)
76 });
72 buf.push_str("];\n"); 77 buf.push_str("];\n");
73 Ok(()) 78 Ok(())
74} 79}