mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-15 15:16:37 +00:00
Fix fs-lock impl
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
3e5f41e27e
commit
ce65159cc7
1 changed files with 5 additions and 6 deletions
|
@ -20,11 +20,10 @@ pub struct FileLock(
|
||||||
|
|
||||||
impl FileLock {
|
impl FileLock {
|
||||||
fn new(file: File) -> Self {
|
fn new(file: File) -> Self {
|
||||||
Self(
|
#[cfg(not(feature = "tracing"))]
|
||||||
file,
|
Self(file)
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
None,
|
Self(file, None)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Take an exclusive lock on a [`File`].
|
/// Take an exclusive lock on a [`File`].
|
||||||
|
@ -33,7 +32,7 @@ impl FileLock {
|
||||||
pub fn new_exclusive(file: File) -> io::Result<Self> {
|
pub fn new_exclusive(file: File) -> io::Result<Self> {
|
||||||
FileExt::lock_exclusive(&file)?;
|
FileExt::lock_exclusive(&file)?;
|
||||||
|
|
||||||
Ok(Self:new(file))
|
Ok(Self::new(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to take an exclusive lock on a [`File`].
|
/// Try to take an exclusive lock on a [`File`].
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue