aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/codegen/gen_lint_completions.rs7
-rw-r--r--xtask/src/metrics.rs5
2 files changed, 8 insertions, 4 deletions
diff --git a/xtask/src/codegen/gen_lint_completions.rs b/xtask/src/codegen/gen_lint_completions.rs
index a28b6cb59..3b54b2489 100644
--- a/xtask/src/codegen/gen_lint_completions.rs
+++ b/xtask/src/codegen/gen_lint_completions.rs
@@ -27,7 +27,7 @@ pub(crate) fn generate_lint_completions() -> Result<()> {
27 generate_feature_descriptor(&mut contents, "./target/rust/src/doc/unstable-book/src".into())?; 27 generate_feature_descriptor(&mut contents, "./target/rust/src/doc/unstable-book/src".into())?;
28 contents.push('\n'); 28 contents.push('\n');
29 29
30 cmd!("curl http://rust-lang.github.io/rust-clippy/master/lints.json --output ./target/clippy_lints.json").run()?; 30 cmd!("curl https://rust-lang.github.io/rust-clippy/master/lints.json --output ./target/clippy_lints.json").run()?;
31 generate_descriptor_clippy(&mut contents, &Path::new("./target/clippy_lints.json"))?; 31 generate_descriptor_clippy(&mut contents, &Path::new("./target/clippy_lints.json"))?;
32 let contents = reformat(&contents)?; 32 let contents = reformat(&contents)?;
33 33
@@ -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 }
diff --git a/xtask/src/metrics.rs b/xtask/src/metrics.rs
index b0b76b8aa..34679062f 100644
--- a/xtask/src/metrics.rs
+++ b/xtask/src/metrics.rs
@@ -81,9 +81,8 @@ impl Metrics {
81 } 81 }
82 fn measure_analysis_stats_path(&mut self, name: &str, path: &str) -> Result<()> { 82 fn measure_analysis_stats_path(&mut self, name: &str, path: &str) -> Result<()> {
83 eprintln!("\nMeasuring analysis-stats/{}", name); 83 eprintln!("\nMeasuring analysis-stats/{}", name);
84 let output = 84 let output = cmd!("./target/release/rust-analyzer -q analysis-stats --memory-usage {path}")
85 cmd!("./target/release/rust-analyzer --quiet analysis-stats --memory-usage {path}") 85 .read()?;
86 .read()?;
87 for (metric, value, unit) in parse_metrics(&output) { 86 for (metric, value, unit) in parse_metrics(&output) {
88 self.report(&format!("analysis-stats/{}/{}", name, metric), value, unit.into()); 87 self.report(&format!("analysis-stats/{}/{}", name, metric), value, unit.into());
89 } 88 }