mirror of
https://github.com/bertptrs/tracing-mutex.git
synced 2025-12-25 12:40:31 +01:00
Opt in to edition 2024 formatting
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -35,6 +35,8 @@ jobs:
|
|||||||
- run: cargo build --all-features --all-targets
|
- run: cargo build --all-features --all-targets
|
||||||
- run: cargo test --all-features
|
- run: cargo test --all-features
|
||||||
- run: cargo fmt --all -- --check
|
- run: cargo fmt --all -- --check
|
||||||
|
# Note: Rust 1.74 doesn't understand edition 2024 formatting so no point
|
||||||
|
if: "${{ matrix.rust != '1.74' }}"
|
||||||
- run: cargo clippy --all-features --all-targets -- -D warnings
|
- run: cargo clippy --all-features --all-targets -- -D warnings
|
||||||
|
|
||||||
msrv:
|
msrv:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use criterion::criterion_group;
|
|
||||||
use criterion::criterion_main;
|
|
||||||
use criterion::BenchmarkId;
|
use criterion::BenchmarkId;
|
||||||
use criterion::Criterion;
|
use criterion::Criterion;
|
||||||
use criterion::Throughput;
|
use criterion::Throughput;
|
||||||
|
use criterion::criterion_group;
|
||||||
|
use criterion::criterion_main;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use tracing_mutex::stdsync::tracing::Mutex as TracingMutex;
|
use tracing_mutex::stdsync::tracing::Mutex as TracingMutex;
|
||||||
|
|
||||||
|
|||||||
1
rustfmt.toml
Normal file
1
rustfmt.toml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
style_edition="2024"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::collections::hash_map::Entry;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
use std::collections::hash_map::Entry;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
type Order = usize;
|
type Order = usize;
|
||||||
|
|||||||
12
src/lib.rs
12
src/lib.rs
@@ -77,12 +77,12 @@ use std::fmt;
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
use std::sync::atomic::AtomicUsize;
|
|
||||||
use std::sync::atomic::Ordering;
|
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::sync::MutexGuard;
|
use std::sync::MutexGuard;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
use std::sync::PoisonError;
|
use std::sync::PoisonError;
|
||||||
|
use std::sync::atomic::AtomicUsize;
|
||||||
|
use std::sync::atomic::Ordering;
|
||||||
|
|
||||||
#[cfg(feature = "lock_api")]
|
#[cfg(feature = "lock_api")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "lockapi")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "lockapi")))]
|
||||||
@@ -351,9 +351,11 @@ mod tests {
|
|||||||
drop(b);
|
drop(b);
|
||||||
|
|
||||||
// If b's destructor correctly ran correctly we can now add an edge from c to a.
|
// If b's destructor correctly ran correctly we can now add an edge from c to a.
|
||||||
assert!(get_dependency_graph()
|
assert!(
|
||||||
.add_edge(c.value(), a.value(), Dep::capture)
|
get_dependency_graph()
|
||||||
.is_ok());
|
.add_edge(c.value(), a.value(), Dep::capture)
|
||||||
|
.is_ok()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Test creating a cycle, then panicking.
|
/// Test creating a cycle, then panicking.
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ use lock_api::RawRwLockUpgradeDowngrade;
|
|||||||
use lock_api::RawRwLockUpgradeFair;
|
use lock_api::RawRwLockUpgradeFair;
|
||||||
use lock_api::RawRwLockUpgradeTimed;
|
use lock_api::RawRwLockUpgradeTimed;
|
||||||
|
|
||||||
use crate::util::PrivateTraced;
|
|
||||||
use crate::LazyMutexId;
|
use crate::LazyMutexId;
|
||||||
use crate::MutexId;
|
use crate::MutexId;
|
||||||
|
use crate::util::PrivateTraced;
|
||||||
|
|
||||||
/// Tracing wrapper for all [`lock_api`] traits.
|
/// Tracing wrapper for all [`lock_api`] traits.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -49,18 +49,18 @@ pub mod tracing;
|
|||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
pub use tracing::{
|
pub use tracing::{
|
||||||
const_fair_mutex, const_mutex, const_reentrant_mutex, const_rwlock, FairMutex, FairMutexGuard,
|
FairMutex, FairMutexGuard, MappedFairMutexGuard, MappedMutexGuard, MappedReentrantMutexGuard,
|
||||||
MappedFairMutexGuard, MappedMutexGuard, MappedReentrantMutexGuard, MappedRwLockReadGuard,
|
MappedRwLockReadGuard, MappedRwLockWriteGuard, Mutex, MutexGuard, Once, RawFairMutex, RawMutex,
|
||||||
MappedRwLockWriteGuard, Mutex, MutexGuard, Once, RawFairMutex, RawMutex, RawRwLock,
|
RawRwLock, ReentrantMutex, ReentrantMutexGuard, RwLock, RwLockReadGuard,
|
||||||
ReentrantMutex, ReentrantMutexGuard, RwLock, RwLockReadGuard, RwLockUpgradableReadGuard,
|
RwLockUpgradableReadGuard, RwLockWriteGuard, const_fair_mutex, const_mutex,
|
||||||
RwLockWriteGuard,
|
const_reentrant_mutex, const_rwlock,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
pub use parking_lot::{
|
pub use parking_lot::{
|
||||||
const_fair_mutex, const_mutex, const_reentrant_mutex, const_rwlock, FairMutex, FairMutexGuard,
|
FairMutex, FairMutexGuard, MappedFairMutexGuard, MappedMutexGuard, MappedReentrantMutexGuard,
|
||||||
MappedFairMutexGuard, MappedMutexGuard, MappedReentrantMutexGuard, MappedRwLockReadGuard,
|
MappedRwLockReadGuard, MappedRwLockWriteGuard, Mutex, MutexGuard, Once, RawFairMutex, RawMutex,
|
||||||
MappedRwLockWriteGuard, Mutex, MutexGuard, Once, RawFairMutex, RawMutex, RawRwLock,
|
RawRwLock, ReentrantMutex, ReentrantMutexGuard, RwLock, RwLockReadGuard,
|
||||||
ReentrantMutex, ReentrantMutexGuard, RwLock, RwLockReadGuard, RwLockUpgradableReadGuard,
|
RwLockUpgradableReadGuard, RwLockWriteGuard, const_fair_mutex, const_mutex,
|
||||||
RwLockWriteGuard,
|
const_reentrant_mutex, const_rwlock,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
pub use parking_lot::OnceState;
|
pub use parking_lot::OnceState;
|
||||||
pub use parking_lot::RawThreadId;
|
pub use parking_lot::RawThreadId;
|
||||||
|
|
||||||
use crate::lockapi::TracingWrapper;
|
|
||||||
use crate::LazyMutexId;
|
use crate::LazyMutexId;
|
||||||
|
use crate::lockapi::TracingWrapper;
|
||||||
|
|
||||||
pub type RawFairMutex = TracingWrapper<::parking_lot::RawFairMutex>;
|
pub type RawFairMutex = TracingWrapper<::parking_lot::RawFairMutex>;
|
||||||
pub type RawMutex = TracingWrapper<::parking_lot::RawMutex>;
|
pub type RawMutex = TracingWrapper<::parking_lot::RawMutex>;
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ use std::sync::TryLockResult;
|
|||||||
use std::sync::WaitTimeoutResult;
|
use std::sync::WaitTimeoutResult;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use crate::util::PrivateTraced;
|
|
||||||
use crate::BorrowedMutex;
|
use crate::BorrowedMutex;
|
||||||
use crate::LazyMutexId;
|
use crate::LazyMutexId;
|
||||||
|
use crate::util::PrivateTraced;
|
||||||
|
|
||||||
#[cfg(has_std__sync__LazyLock)]
|
#[cfg(has_std__sync__LazyLock)]
|
||||||
pub use lazy_lock::LazyLock;
|
pub use lazy_lock::LazyLock;
|
||||||
|
|||||||
Reference in New Issue
Block a user