Skip to content

Commit afe5333

Browse files
committed
Remove most clone where clippy::clone_on_copy
1 parent 97bf02b commit afe5333

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/cargo/core/compiler/fingerprint/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,16 +1037,16 @@ impl Fingerprint {
10371037
for (a, b) in self.deps.iter().zip(old.deps.iter()) {
10381038
if a.name != b.name {
10391039
return DirtyReason::UnitDependencyNameChanged {
1040-
old: b.name.clone(),
1041-
new: a.name.clone(),
1040+
old: b.name,
1041+
new: a.name,
10421042
};
10431043
}
10441044

10451045
if a.fingerprint.hash_u64() != b.fingerprint.hash_u64() {
10461046
return DirtyReason::UnitDependencyInfoChanged {
1047-
new_name: a.name.clone(),
1047+
new_name: a.name,
10481048
new_fingerprint: a.fingerprint.hash_u64(),
1049-
old_name: b.name.clone(),
1049+
old_name: b.name,
10501050
old_fingerprint: b.fingerprint.hash_u64(),
10511051
};
10521052
}
@@ -1122,9 +1122,7 @@ impl Fingerprint {
11221122
| FsStatus::StaleItem(_)
11231123
| FsStatus::StaleDependency { .. }
11241124
| FsStatus::StaleDepFingerprint { .. } => {
1125-
self.fs_status = FsStatus::StaleDepFingerprint {
1126-
name: dep.name.clone(),
1127-
};
1125+
self.fs_status = FsStatus::StaleDepFingerprint { name: dep.name };
11281126
return Ok(());
11291127
}
11301128
};
@@ -1166,7 +1164,7 @@ impl Fingerprint {
11661164
);
11671165

11681166
self.fs_status = FsStatus::StaleDependency {
1169-
name: dep.name.clone(),
1167+
name: dep.name,
11701168
dep_mtime: *dep_mtime,
11711169
max_mtime: *max_mtime,
11721170
};

src/cargo/util/toml/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,8 @@ impl TomlProfile {
800800
self.codegen_units = Some(v);
801801
}
802802

803-
if let Some(v) = &profile.debug {
804-
self.debug = Some(v.clone());
803+
if let Some(v) = profile.debug {
804+
self.debug = Some(v);
805805
}
806806

807807
if let Some(v) = profile.debug_assertions {
@@ -1978,7 +1978,7 @@ impl TomlManifest {
19781978
)
19791979
}
19801980
}
1981-
Some(rust_version.clone())
1981+
Some(rust_version)
19821982
} else {
19831983
None
19841984
};
@@ -2358,7 +2358,7 @@ impl TomlManifest {
23582358
.categories
23592359
.as_ref()
23602360
.map(|_| MaybeWorkspace::Defined(metadata.categories.clone()));
2361-
package.rust_version = rust_version.clone().map(|rv| MaybeWorkspace::Defined(rv));
2361+
package.rust_version = rust_version.map(|rv| MaybeWorkspace::Defined(rv));
23622362
package.exclude = package
23632363
.exclude
23642364
.as_ref()

0 commit comments

Comments
 (0)