indexed_docs: Remove some unnecessary cloning (#30236)
Other small patch to reduce allocations. `.iter().cloned().collect()` calls `Clone` per element, whereas `.into_iter().collect()` preallocates the `Vec`. The Zed repo for example has up to 1700 packages on some build configurations, meaning this change theoretically saves up to 1699 allocations. It's likely the compiler has already optimized this away, but it's good to be explicit. Release Notes: - N/A
This commit is contained in:
parent
a61958e886
commit
4b5158b168
1 changed files with 1 additions and 1 deletions
|
@ -79,7 +79,7 @@ impl IndexedDocsProvider for LocalRustdocProvider {
|
|||
|
||||
*WORKSPACE_CRATES.write() = Some((workspace_crates.clone(), Instant::now()));
|
||||
|
||||
Ok(workspace_crates.iter().cloned().collect())
|
||||
Ok(workspace_crates.into_iter().collect())
|
||||
}
|
||||
|
||||
async fn index(&self, package: PackageName, database: Arc<IndexedDocsDatabase>) -> Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue