Skip to content

Commit df7d392

Browse files
committed
refactor: Update IndexPackage to use Cow for links
Signed-off-by: 0xPoe <techregister@pm.me>
1 parent 4815436 commit df7d392

File tree

1 file changed

+3
-8
lines changed
  • src/cargo/sources/registry/index

1 file changed

+3
-8
lines changed

src/cargo/sources/registry/index/mod.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ pub struct IndexPackage<'a> {
226226
///
227227
/// Added early 2018 (see <https://github.com/rust-lang/cargo/pull/4978>),
228228
/// can be `None` if published before then.
229-
pub links: Option<InternedString>,
229+
pub links: Option<Cow<'a, str>>,
230230
/// Required version of rust
231231
///
232232
/// Corresponds to `package.rust-version`.
@@ -291,13 +291,8 @@ impl IndexPackage<'_> {
291291
)
292292
})
293293
.collect::<BTreeMap<_, _>>();
294-
let mut summary = Summary::new(
295-
pkgid,
296-
deps,
297-
&features,
298-
self.links,
299-
self.rust_version.clone(),
300-
)?;
294+
let links = self.links.as_ref().map(|l| InternedString::new(&l));
295+
let mut summary = Summary::new(pkgid, deps, &features, links, self.rust_version.clone())?;
301296
summary.set_checksum(self.cksum.clone());
302297
Ok(summary)
303298
}

0 commit comments

Comments
 (0)