aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src/codegen')
-rw-r--r--xtask/src/codegen/gen_assists_docs.rs4
-rw-r--r--xtask/src/codegen/gen_parser_tests.rs10
-rw-r--r--xtask/src/codegen/gen_syntax.rs2
3 files changed, 7 insertions, 9 deletions
diff --git a/xtask/src/codegen/gen_assists_docs.rs b/xtask/src/codegen/gen_assists_docs.rs
index 158680993..c91716409 100644
--- a/xtask/src/codegen/gen_assists_docs.rs
+++ b/xtask/src/codegen/gen_assists_docs.rs
@@ -154,8 +154,8 @@ fn hide_hash_comments(text: &str) -> String {
154fn reveal_hash_comments(text: &str) -> String { 154fn reveal_hash_comments(text: &str) -> String {
155 text.split('\n') // want final newline 155 text.split('\n') // want final newline
156 .map(|it| { 156 .map(|it| {
157 if it.starts_with("# ") { 157 if let Some(stripped) = it.strip_prefix("# ") {
158 &it[2..] 158 stripped
159 } else if it == "#" { 159 } else if it == "#" {
160 "" 160 ""
161 } else { 161 } else {
diff --git a/xtask/src/codegen/gen_parser_tests.rs b/xtask/src/codegen/gen_parser_tests.rs
index 096590653..2fecb9b5b 100644
--- a/xtask/src/codegen/gen_parser_tests.rs
+++ b/xtask/src/codegen/gen_parser_tests.rs
@@ -60,12 +60,10 @@ fn collect_tests(s: &str) -> Vec<Test> {
60 let mut res = Vec::new(); 60 let mut res = Vec::new();
61 for comment_block in extract_comment_blocks(s) { 61 for comment_block in extract_comment_blocks(s) {
62 let first_line = &comment_block[0]; 62 let first_line = &comment_block[0];
63 let (name, ok) = if first_line.starts_with("test ") { 63 let (name, ok) = if let Some(name) = first_line.strip_prefix("test ") {
64 let name = first_line["test ".len()..].to_string(); 64 (name.to_string(), true)
65 (name, true) 65 } else if let Some(name) = first_line.strip_prefix("test_err ") {
66 } else if first_line.starts_with("test_err ") { 66 (name.to_string(), false)
67 let name = first_line["test_err ".len()..].to_string();
68 (name, false)
69 } else { 67 } else {
70 continue; 68 continue;
71 }; 69 };
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index 80f26e8f5..ba4b24848 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -707,7 +707,7 @@ fn extract_struct_trait(node: &mut AstNodeSrc, trait_name: &str, methods: &[&str
707 let mut to_remove = Vec::new(); 707 let mut to_remove = Vec::new();
708 for (i, field) in node.fields.iter().enumerate() { 708 for (i, field) in node.fields.iter().enumerate() {
709 let method_name = field.method_name().to_string(); 709 let method_name = field.method_name().to_string();
710 if methods.iter().any(|&it| it == &method_name) { 710 if methods.iter().any(|&it| it == method_name) {
711 to_remove.push(i); 711 to_remove.push(i);
712 } 712 }
713 } 713 }