From ce65159cc7db8e0a885165ec5eb3643806e80fa2 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Sat, 22 Feb 2025 23:08:20 +1100 Subject: [PATCH] Fix fs-lock impl Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --- crates/fs-lock/src/lib.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/fs-lock/src/lib.rs b/crates/fs-lock/src/lib.rs index 9a0b3010..a14a99f0 100644 --- a/crates/fs-lock/src/lib.rs +++ b/crates/fs-lock/src/lib.rs @@ -20,11 +20,10 @@ pub struct FileLock( impl FileLock { fn new(file: File) -> Self { - Self( - file, - #[cfg(feature = "tracing")] - None, - ) + #[cfg(not(feature = "tracing"))] + Self(file) + #[cfg(feature = "tracing")] + Self(file, None) } /// Take an exclusive lock on a [`File`]. @@ -33,7 +32,7 @@ impl FileLock { pub fn new_exclusive(file: File) -> io::Result<Self> { FileExt::lock_exclusive(&file)?; - Ok(Self:new(file)) + Ok(Self::new(file)) } /// Try to take an exclusive lock on a [`File`].