Fix fmt in cargo_crates_v1.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2025-06-04 00:42:09 +10:00 committed by GitHub
parent c929883e47
commit f5a4b70be4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
} }