Skip to content

Commit a20325f

Browse files
Remove unnecessary clones in resolver (#420)
1 parent 13ba440 commit a20325f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

crates/puffin-resolver/src/resolver.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ impl<'a, Context: BuildContext + Sync> Resolver<'a, Context> {
330330
// Emit a request to fetch the metadata for this version.
331331
if in_flight.insert_file(&candidate.file) {
332332
let distribution = Dist::from_registry(
333-
candidate.package_name.clone(),
334-
candidate.version.clone().into(),
335-
candidate.file.clone().into(),
333+
candidate.package_name,
334+
candidate.version.into(),
335+
candidate.file.into(),
336336
);
337337
request_sink.unbounded_send(Request::Dist(distribution))?;
338338
}
@@ -419,17 +419,18 @@ impl<'a, Context: BuildContext + Sync> Resolver<'a, Context> {
419419
candidate.file.clone().into(),
420420
);
421421

422+
let version = candidate.version.clone();
423+
422424
// Emit a request to fetch the metadata for this version.
423425
if in_flight.insert_file(&candidate.file) {
424426
let distribution = Dist::from_registry(
425-
candidate.package_name.clone(),
426-
candidate.version.clone().into(),
427-
candidate.file.clone().into(),
427+
candidate.package_name,
428+
candidate.version.into(),
429+
candidate.file.into(),
428430
);
429431
request_sink.unbounded_send(Request::Dist(distribution))?;
430432
}
431433

432-
let version = candidate.version.clone();
433434
Ok(Some(version))
434435
}
435436
};
@@ -559,7 +560,7 @@ impl<'a, Context: BuildContext + Sync> Resolver<'a, Context> {
559560
}
560561
if let Ok(filename) = WheelFilename::from_str(file.filename.as_str()) {
561562
if filename.is_compatible(self.tags) {
562-
let version = PubGrubVersion::from(filename.version.clone());
563+
let version = PubGrubVersion::from(filename.version);
563564
match version_map.entry(version) {
564565
std::collections::btree_map::Entry::Occupied(mut entry) => {
565566
if matches!(entry.get(), DistFile::Sdist(_)) {
@@ -575,7 +576,7 @@ impl<'a, Context: BuildContext + Sync> Resolver<'a, Context> {
575576
} else if let Ok(filename) =
576577
SourceDistFilename::parse(file.filename.as_str(), &package_name)
577578
{
578-
let version = PubGrubVersion::from(filename.version.clone());
579+
let version = PubGrubVersion::from(filename.version);
579580
if let std::collections::btree_map::Entry::Vacant(entry) =
580581
version_map.entry(version)
581582
{

0 commit comments

Comments
 (0)