Fix clippy::redundant_clone
lint violations (#36558)
This removes around 900 unnecessary clones, ranging from cloning a few ints all the way to large data structures and images. A lot of these were fixed using `cargo clippy --fix --workspace --all-targets`, however it often breaks other lints and needs to be run again. This was then followed up with some manual fixing. I understand this is a large diff, but all the changes are pretty trivial. Rust is doing some heavy lifting here for us. Once I get it up to speed with main, I'd appreciate this getting merged rather sooner than later. Release Notes: - N/A
This commit is contained in:
parent
cf7c64d77f
commit
7bdc99abc1
306 changed files with 805 additions and 1102 deletions
|
@ -769,7 +769,7 @@ impl GitStore {
|
|||
.as_ref()
|
||||
.and_then(|weak| weak.upgrade())
|
||||
{
|
||||
let conflict_set = conflict_set.clone();
|
||||
let conflict_set = conflict_set;
|
||||
let buffer_snapshot = buffer.read(cx).text_snapshot();
|
||||
|
||||
git_state.update(cx, |state, cx| {
|
||||
|
@ -912,7 +912,7 @@ impl GitStore {
|
|||
return Task::ready(Err(anyhow!("failed to find a git repository for buffer")));
|
||||
};
|
||||
let content = match &version {
|
||||
Some(version) => buffer.rope_for_version(version).clone(),
|
||||
Some(version) => buffer.rope_for_version(version),
|
||||
None => buffer.as_rope().clone(),
|
||||
};
|
||||
let version = version.unwrap_or(buffer.version());
|
||||
|
@ -1506,10 +1506,7 @@ impl GitStore {
|
|||
let mut update = envelope.payload;
|
||||
|
||||
let id = RepositoryId::from_proto(update.id);
|
||||
let client = this
|
||||
.upstream_client()
|
||||
.context("no upstream client")?
|
||||
.clone();
|
||||
let client = this.upstream_client().context("no upstream client")?;
|
||||
|
||||
let mut is_new = false;
|
||||
let repo = this.repositories.entry(id).or_insert_with(|| {
|
||||
|
@ -3418,7 +3415,6 @@ impl Repository {
|
|||
reset_mode: ResetMode,
|
||||
_cx: &mut App,
|
||||
) -> oneshot::Receiver<Result<()>> {
|
||||
let commit = commit.to_string();
|
||||
let id = self.id;
|
||||
|
||||
self.send_job(None, move |git_repo, _| async move {
|
||||
|
@ -3644,7 +3640,7 @@ impl Repository {
|
|||
let to_stage = self
|
||||
.cached_status()
|
||||
.filter(|entry| !entry.status.staging().is_fully_staged())
|
||||
.map(|entry| entry.repo_path.clone())
|
||||
.map(|entry| entry.repo_path)
|
||||
.collect();
|
||||
self.stage_entries(to_stage, cx)
|
||||
}
|
||||
|
@ -3653,16 +3649,13 @@ impl Repository {
|
|||
let to_unstage = self
|
||||
.cached_status()
|
||||
.filter(|entry| entry.status.staging().has_staged())
|
||||
.map(|entry| entry.repo_path.clone())
|
||||
.map(|entry| entry.repo_path)
|
||||
.collect();
|
||||
self.unstage_entries(to_unstage, cx)
|
||||
}
|
||||
|
||||
pub fn stash_all(&mut self, cx: &mut Context<Self>) -> Task<anyhow::Result<()>> {
|
||||
let to_stash = self
|
||||
.cached_status()
|
||||
.map(|entry| entry.repo_path.clone())
|
||||
.collect();
|
||||
let to_stash = self.cached_status().map(|entry| entry.repo_path).collect();
|
||||
|
||||
self.stash_entries(to_stash, cx)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue