Refactor: Extract CratesToml::append{_to_path}

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-21 19:50:23 +10:00
parent ef72f851f7
commit 31d9716d28
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 21 additions and 6 deletions

View file

@ -109,12 +109,8 @@ async fn install_from_package(
let bins: BTreeSet<String> = bin_files.into_iter().map(|bin| bin.base_name).collect();
{
debug!("Writing .crates.toml");
let mut c1 = metafiles::v1::CratesToml::load().unwrap_or_default();
c1.insert(cvs.clone(), bins.clone());
c1.write()?;
}
debug!("Writing .crates.toml");
metafiles::v1::CratesToml::append(cvs.clone(), bins.clone())?;
{
debug!("Writing .crates2.json");