mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-14 14:46:37 +00:00
Fix fmt in cargo_crates_v1.rs
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
c929883e47
commit
f5a4b70be4
1 changed files with 8 additions and 2 deletions
|
@ -114,7 +114,10 @@ impl CratesToml<'_> {
|
||||||
pub fn append_to_file(file: &mut File, crates: &[CrateInfo]) -> Result<(), CratesTomlParseError> {
|
pub fn append_to_file(file: &mut File, crates: &[CrateInfo]) -> Result<(), CratesTomlParseError> {
|
||||||
let mut c1 = CratesToml::load_from_reader(&mut *file)?;
|
let mut c1 = CratesToml::load_from_reader(&mut *file)?;
|
||||||
|
|
||||||
let mut crate_names: Vec<_> = crates.iter().map(|metadata| metadata.name.as_str()).collect();
|
let mut crate_names: Vec<_> = crates
|
||||||
|
.iter()
|
||||||
|
.map(|metadata| metadata.name.as_str())
|
||||||
|
.collect();
|
||||||
crate_names.sort_unstable();
|
crate_names.sort_unstable();
|
||||||
c1.remove_all(&crate_names);
|
c1.remove_all(&crate_names);
|
||||||
|
|
||||||
|
@ -137,7 +140,10 @@ impl CratesToml<'_> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn append_to_path(path: impl AsRef<Path>, crates: &[CrateInfo]) -> Result<(), CratesTomlParseError> {
|
pub fn append_to_path(
|
||||||
|
path: impl AsRef<Path>,
|
||||||
|
crates: &[CrateInfo],
|
||||||
|
) -> Result<(), CratesTomlParseError> {
|
||||||
let mut file = create_if_not_exist(path.as_ref())?;
|
let mut file = create_if_not_exist(path.as_ref())?;
|
||||||
Self::append_to_file(&mut file, crates)
|
Self::append_to_file(&mut file, crates)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue