Enable clippy::clone_on_copy (#8728)

This PR enables the
[`clippy::clone_on_copy`](https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_copy)
rule and fixes the outstanding violations.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-02 17:37:48 -05:00 committed by GitHub
parent 5935681c5c
commit 9735912965
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 144 additions and 160 deletions

View file

@ -456,8 +456,7 @@ impl VectorDatabase {
if batch_ids.len() == batch_n {
let embeddings = std::mem::take(&mut batch_embeddings);
let ids = std::mem::take(&mut batch_ids);
let array =
Array2::from_shape_vec((ids.len(), embedding_len.clone()), embeddings);
let array = Array2::from_shape_vec((ids.len(), embedding_len), embeddings);
match array {
Ok(array) => {
batches.push((ids, array));

View file

@ -329,7 +329,7 @@ impl SemanticIndex {
SemanticIndexStatus::Indexed
} else {
SemanticIndexStatus::Indexing {
remaining_files: project_state.pending_file_count_rx.borrow().clone(),
remaining_files: *project_state.pending_file_count_rx.borrow(),
rate_limit_expiry: self.embedding_provider.rate_limit_expiration(),
}
}
@ -497,7 +497,7 @@ impl SemanticIndex {
changes: Arc<[(Arc<Path>, ProjectEntryId, PathChange)]>,
cx: &mut ModelContext<Self>,
) {
let Some(worktree) = project.read(cx).worktree_for_id(worktree_id.clone(), cx) else {
let Some(worktree) = project.read(cx).worktree_for_id(worktree_id, cx) else {
return;
};
let project = project.downgrade();
@ -840,7 +840,7 @@ impl SemanticIndex {
let mut batch_results = Vec::new();
for batch in file_ids.chunks(batch_size) {
let batch = batch.into_iter().map(|v| *v).collect::<Vec<i64>>();
let limit = limit.clone();
let limit = limit;
let fs = fs.clone();
let db_path = db_path.clone();
let query = query.clone();