aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-21 15:49:31 +0000
committerGitHub <[email protected]>2021-03-21 15:49:31 +0000
commitd51cf133f68eec63eee27a8666c7590d2e8b4ef8 (patch)
treecd74909ed13e4a697459bf66afffcb06d89820cd /xtask/src
parent5bb65bb4962cfad613e9744a340ae23b533f479e (diff)
parent202b51bc7b6999900e06ec2cfb8d72fe9aa4af29 (diff)
Merge #8135
8135: more clippy::{perf, complexity, style} fixes r=Veykril a=matthiaskrgr Co-authored-by: Matthias Krüger <[email protected]>
Diffstat (limited to 'xtask/src')
-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
-rw-r--r--xtask/src/main.rs2
-rw-r--r--xtask/src/metrics.rs2
-rw-r--r--xtask/src/tidy.rs2
6 files changed, 10 insertions, 12 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 }
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 915aae71a..960927fc0 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -37,7 +37,7 @@ fn main() -> Result<()> {
37 match flags.subcommand { 37 match flags.subcommand {
38 flags::XtaskCmd::Help(_) => { 38 flags::XtaskCmd::Help(_) => {
39 println!("{}", flags::Xtask::HELP); 39 println!("{}", flags::Xtask::HELP);
40 return Ok(()); 40 Ok(())
41 } 41 }
42 flags::XtaskCmd::Install(cmd) => cmd.run(), 42 flags::XtaskCmd::Install(cmd) => cmd.run(),
43 flags::XtaskCmd::FuzzTests(_) => run_fuzzer(), 43 flags::XtaskCmd::FuzzTests(_) => run_fuzzer(),
diff --git a/xtask/src/metrics.rs b/xtask/src/metrics.rs
index 97395738b..b0b76b8aa 100644
--- a/xtask/src/metrics.rs
+++ b/xtask/src/metrics.rs
@@ -167,7 +167,7 @@ impl Host {
167 167
168 return Ok(Host { os, cpu, mem }); 168 return Ok(Host { os, cpu, mem });
169 169
170 fn read_field<'a>(path: &str, field: &str) -> Result<String> { 170 fn read_field(path: &str, field: &str) -> Result<String> {
171 let text = read_file(path)?; 171 let text = read_file(path)?;
172 172
173 let line = text 173 let line = text
diff --git a/xtask/src/tidy.rs b/xtask/src/tidy.rs
index 1352d1218..50d9efccd 100644
--- a/xtask/src/tidy.rs
+++ b/xtask/src/tidy.rs
@@ -193,7 +193,7 @@ https://github.blog/2015-06-08-how-to-undo-almost-anything-with-git/#redo-after-
193 } 193 }
194} 194}
195 195
196fn deny_clippy(path: &PathBuf, text: &String) { 196fn deny_clippy(path: &Path, text: &str) {
197 let ignore = &[ 197 let ignore = &[
198 // The documentation in string literals may contain anything for its own purposes 198 // The documentation in string literals may contain anything for its own purposes
199 "ide_completion/src/generated_lint_completions.rs", 199 "ide_completion/src/generated_lint_completions.rs",