Fix clippy issues

This commit is contained in:
2025-01-18 12:02:23 +01:00
parent 25ae542ade
commit 7a943ebba6
2 changed files with 8 additions and 3 deletions

5
Cargo.lock generated
View File

@@ -25,9 +25,9 @@ checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@@ -619,6 +619,7 @@ dependencies = [
name = "tracing-mutex" name = "tracing-mutex"
version = "0.3.0" version = "0.3.0"
dependencies = [ dependencies = [
"autocfg",
"criterion", "criterion",
"lock_api", "lock_api",
"parking_lot", "parking_lot",

View File

@@ -29,6 +29,8 @@ use crate::LazyMutexId;
/// println!("{}", *LOCK); /// println!("{}", *LOCK);
/// ``` /// ```
pub struct LazyLock<T, F = fn() -> T> { pub struct LazyLock<T, F = fn() -> T> {
// MSRV violation is fine, this is gated behind a cfg! check
#[allow(clippy::incompatible_msrv)]
inner: std::sync::LazyLock<T, F>, inner: std::sync::LazyLock<T, F>,
id: LazyMutexId, id: LazyMutexId,
} }
@@ -38,6 +40,8 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
pub const fn new(f: F) -> LazyLock<T, F> { pub const fn new(f: F) -> LazyLock<T, F> {
Self { Self {
id: LazyMutexId::new(), id: LazyMutexId::new(),
// MSRV violation is fine, this is gated behind a cfg! check
#[allow(clippy::incompatible_msrv)]
inner: std::sync::LazyLock::new(f), inner: std::sync::LazyLock::new(f),
} }
} }
@@ -46,7 +50,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
/// ///
/// This is equivalent to dereferencing, but is more explicit. /// This is equivalent to dereferencing, but is more explicit.
pub fn force(this: &LazyLock<T, F>) -> &T { pub fn force(this: &LazyLock<T, F>) -> &T {
&*this this
} }
} }