Fix fs-lock lib.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2025-02-23 00:57:01 +11:00 committed by GitHub
parent 090884a70f
commit 80bc78de09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,7 @@
//! These use the same mechanisms as, and are interoperable with, Cargo. //! These use the same mechanisms as, and are interoperable with, Cargo.
use std::{ use std::{
fs::File. fs::File,
io::{self, IoSlice, IoSliceMut, SeekFrom}, io::{self, IoSlice, IoSliceMut, SeekFrom},
ops, path::Path, ops, path::Path,
}; };
@ -19,10 +19,13 @@ pub struct FileLock(
); );
impl FileLock { impl FileLock {
#[cfg(not(feature = "tracing"))]
fn new(file: File) -> Self { fn new(file: File) -> Self {
#[cfg(not(feature = "tracing"))]
Self(file) Self(file)
#[cfg(feature = "tracing")] }
#[cfg(feature = "tracing")]
fn new(file: File) -> Self {
Self(file, None) Self(file, None)
} }