mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Avoid CrateVersionSource::clone
for insertion in metafiles
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
de9404feda
commit
a3fcc298ab
3 changed files with 8 additions and 8 deletions
|
@ -110,11 +110,11 @@ async fn install_from_package(
|
|||
let bins: BTreeSet<String> = bin_files.into_iter().map(|bin| bin.base_name).collect();
|
||||
|
||||
debug!("Writing .crates.toml");
|
||||
metafiles::v1::CratesToml::append(cvs.clone(), bins.clone())?;
|
||||
metafiles::v1::CratesToml::append(&cvs, bins.clone())?;
|
||||
|
||||
debug!("Writing .crates2.json");
|
||||
metafiles::v2::Crates2Json::append(
|
||||
cvs,
|
||||
&cvs,
|
||||
metafiles::v2::CrateInfo {
|
||||
version_req: Some(version),
|
||||
bins,
|
||||
|
|
|
@ -30,7 +30,7 @@ impl CratesToml {
|
|||
Self::from_str(&file)
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, cvs: CrateVersionSource, bins: BTreeSet<String>) {
|
||||
pub fn insert(&mut self, cvs: &CrateVersionSource, bins: BTreeSet<String>) {
|
||||
self.v1.insert(cvs.to_string(), bins);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ impl CratesToml {
|
|||
|
||||
pub fn append_to_path(
|
||||
path: impl AsRef<Path>,
|
||||
cvs: CrateVersionSource,
|
||||
cvs: &CrateVersionSource,
|
||||
bins: BTreeSet<String>,
|
||||
) -> Result<(), CratesTomlParseError> {
|
||||
let mut c1 = match Self::load_from_path(path.as_ref()) {
|
||||
|
@ -62,7 +62,7 @@ impl CratesToml {
|
|||
}
|
||||
|
||||
pub fn append(
|
||||
cvs: CrateVersionSource,
|
||||
cvs: &CrateVersionSource,
|
||||
bins: BTreeSet<String>,
|
||||
) -> Result<(), CratesTomlParseError> {
|
||||
Self::append_to_path(Self::default_path()?, cvs, bins)
|
||||
|
|
|
@ -51,7 +51,7 @@ impl Crates2Json {
|
|||
Ok(serde_json::from_reader(file)?)
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, cvs: CrateVersionSource, info: CrateInfo) {
|
||||
pub fn insert(&mut self, cvs: &CrateVersionSource, info: CrateInfo) {
|
||||
self.installs.insert(cvs.to_string(), info);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ impl Crates2Json {
|
|||
|
||||
pub fn append_to_path(
|
||||
path: impl AsRef<Path>,
|
||||
cvs: CrateVersionSource,
|
||||
cvs: &CrateVersionSource,
|
||||
info: CrateInfo,
|
||||
) -> Result<(), Crates2JsonParseError> {
|
||||
let mut c2 = match Self::load_from_path(path.as_ref()) {
|
||||
|
@ -83,7 +83,7 @@ impl Crates2Json {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn append(cvs: CrateVersionSource, info: CrateInfo) -> Result<(), Crates2JsonParseError> {
|
||||
pub fn append(cvs: &CrateVersionSource, info: CrateInfo) -> Result<(), Crates2JsonParseError> {
|
||||
Self::append_to_path(Self::default_path()?, cvs, info)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue