Skip to content

Commit

Permalink
Remove most clone where clippy::clone_on_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Sep 13, 2023
1 parent 97bf02b commit afe5333
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
14 changes: 6 additions & 8 deletions src/cargo/core/compiler/fingerprint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,16 +1037,16 @@ impl Fingerprint {
for (a, b) in self.deps.iter().zip(old.deps.iter()) {
if a.name != b.name {
return DirtyReason::UnitDependencyNameChanged {
old: b.name.clone(),
new: a.name.clone(),
old: b.name,
new: a.name,
};
}

if a.fingerprint.hash_u64() != b.fingerprint.hash_u64() {
return DirtyReason::UnitDependencyInfoChanged {
new_name: a.name.clone(),
new_name: a.name,
new_fingerprint: a.fingerprint.hash_u64(),
old_name: b.name.clone(),
old_name: b.name,
old_fingerprint: b.fingerprint.hash_u64(),
};
}
Expand Down Expand Up @@ -1122,9 +1122,7 @@ impl Fingerprint {
| FsStatus::StaleItem(_)
| FsStatus::StaleDependency { .. }
| FsStatus::StaleDepFingerprint { .. } => {
self.fs_status = FsStatus::StaleDepFingerprint {
name: dep.name.clone(),
};
self.fs_status = FsStatus::StaleDepFingerprint { name: dep.name };
return Ok(());
}
};
Expand Down Expand Up @@ -1166,7 +1164,7 @@ impl Fingerprint {
);

self.fs_status = FsStatus::StaleDependency {
name: dep.name.clone(),
name: dep.name,
dep_mtime: *dep_mtime,
max_mtime: *max_mtime,
};
Expand Down
8 changes: 4 additions & 4 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,8 @@ impl TomlProfile {
self.codegen_units = Some(v);
}

if let Some(v) = &profile.debug {
self.debug = Some(v.clone());
if let Some(v) = profile.debug {
self.debug = Some(v);
}

if let Some(v) = profile.debug_assertions {
Expand Down Expand Up @@ -1978,7 +1978,7 @@ impl TomlManifest {
)
}
}
Some(rust_version.clone())
Some(rust_version)
} else {
None
};
Expand Down Expand Up @@ -2358,7 +2358,7 @@ impl TomlManifest {
.categories
.as_ref()
.map(|_| MaybeWorkspace::Defined(metadata.categories.clone()));
package.rust_version = rust_version.clone().map(|rv| MaybeWorkspace::Defined(rv));
package.rust_version = rust_version.map(|rv| MaybeWorkspace::Defined(rv));
package.exclude = package
.exclude
.as_ref()
Expand Down

0 comments on commit afe5333

Please sign in to comment.