Update create_if_not_exist usage in mod binstall_crates_v1

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2025-02-22 22:45:44 +11:00 committed by GitHub
parent 90e824d57c
commit 239116db68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,7 +43,8 @@ where
Iter: IntoIterator<Item = T>,
Data: From<T>,
{
let mut file = FileLock::new_exclusive(create_if_not_exist(path.as_ref())?)?;
let path = path.as_ref();
let mut file = create_if_not_exist(path)?;
// Move the cursor to EOF
file.seek(io::SeekFrom::End(0))?;
@ -166,7 +167,7 @@ impl Records {
pub fn load_from_path(path: impl AsRef<Path>) -> Result<Self, Error> {
let mut this = Self {
file: FileLock::new_exclusive(create_if_not_exist(path.as_ref())?)?,
file: create_if_not_exist(path.as_ref())?,
data: BTreeSet::default(),
};
this.load_impl()?;