From 47f40d468acae7e37d101cee9a6d79bff3461c64 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 15 Aug 2024 16:13:53 +0200 Subject: [PATCH] Improve rendering speed by moving settings generation after theme rendering --- tests/compile-test.rs | 11 +++++-- util/gh-pages/index_template.html | 4 +-- util/gh-pages/script.js | 49 ++++++++++++++++--------------- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index 00627dc0bb1f9..162aed393c461 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -9,7 +9,8 @@ use clippy_lints::LintInfo; use clippy_lints::declared_lints::LINTS; use clippy_lints::deprecated_lints::{DEPRECATED, DEPRECATED_VERSION, RENAMED}; use pulldown_cmark::{Options, Parser, html}; -use rinja::{Template, filters::Safe}; +use rinja::Template; +use rinja::filters::Safe; use serde::Deserialize; use test_utils::IS_RUSTC_TEST_SUITE; use ui_test::custom_flags::Flag; @@ -394,7 +395,7 @@ struct Renderer<'a> { } impl<'a> Renderer<'a> { - fn markdown(&self, input: &str) -> Safe { + fn markdown(input: &str) -> Safe { let parser = Parser::new_ext(input, Options::all()); let mut html_output = String::new(); html::push_html(&mut html_output, parser); @@ -465,7 +466,11 @@ impl DiagnosticCollector { .collect(); metadata.sort_unstable_by(|a, b| a.id.cmp(&b.id)); - fs::write("util/gh-pages/index.html", Renderer { lints: &metadata }.render().unwrap()).unwrap(); + fs::write( + "util/gh-pages/index.html", + Renderer { lints: &metadata }.render().unwrap(), + ) + .unwrap(); }); (Self { sender }, handle) diff --git a/util/gh-pages/index_template.html b/util/gh-pages/index_template.html index 774c7b487c166..d942cbe39e72d 100644 --- a/util/gh-pages/index_template.html +++ b/util/gh-pages/index_template.html @@ -1,7 +1,7 @@