diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-11-08 00:47:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-08 00:47:51 +0100 |
| commit | 7552dd19adadcc42ed305ec81cc255a36b78c4bf (patch) | |
| tree | 3f725015af7498aa8850de6f45acae1203c5fe46 /src/librustdoc/html/render/write_shared.rs | |
| parent | 3c6307240cc1c41ec18ac3b5f86add84aa286f77 (diff) | |
| parent | e8cf29b584ce684351ceacbf7e06be6c0874c9be (diff) | |
Rollup merge of #117625 - nnethercote:clippy-perf, r=cuviper
Fix some clippy perf lints `@matthiaskrgr` gave me the output of a clippy run with perf lints enabled. This PR fixes ones that I thought were worth fixing. r? `@cuviper`
Diffstat (limited to 'src/librustdoc/html/render/write_shared.rs')
| -rw-r--r-- | src/librustdoc/html/render/write_shared.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 3e58dd96ed9..d2c7c578c08 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -356,15 +356,12 @@ if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; let content = format!( "<h1>List of all crates</h1><ul class=\"all-items\">{}</ul>", - krates - .iter() - .map(|s| { - format!( - "<li><a href=\"{trailing_slash}index.html\">{s}</a></li>", - trailing_slash = ensure_trailing_slash(s), - ) - }) - .collect::<String>() + krates.iter().format_with("", |k, f| { + f(&format_args!( + "<li><a href=\"{trailing_slash}index.html\">{k}</a></li>", + trailing_slash = ensure_trailing_slash(k), + )) + }) ); let v = layout::render(&shared.layout, &page, "", content, &shared.style_files); shared.fs.write(dst, v)?; |
