Skip to content

Commit

Permalink
Clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vorner committed Feb 20, 2024
1 parent a6d4b0e commit facb839
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ mod tests {
}

#[test]
#[allow(clippy::arc_with_non_send_sync)] // Whatever, it's tests...
fn double_dyn_access_complex() {
struct Inner {
val: usize,
Expand Down
34 changes: 16 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,24 @@
//! use arc_swap::ArcSwap;
//! use crossbeam_utils::thread;
//!
//! fn main() {
//! let config = ArcSwap::from(Arc::new(String::default()));
//! thread::scope(|scope| {
//! let config = ArcSwap::from(Arc::new(String::default()));
//! thread::scope(|scope| {
//! scope.spawn(|_| {
//! let new_conf = Arc::new("New configuration".to_owned());
//! config.store(new_conf);
//! });
//! for _ in 0..10 {
//! scope.spawn(|_| {
//! let new_conf = Arc::new("New configuration".to_owned());
//! config.store(new_conf);
//! });
//! for _ in 0..10 {
//! scope.spawn(|_| {
//! loop {
//! let cfg = config.load();
//! if !cfg.is_empty() {
//! assert_eq!(**cfg, "New configuration");
//! return;
//! }
//! loop {
//! let cfg = config.load();
//! if !cfg.is_empty() {
//! assert_eq!(**cfg, "New configuration");
//! return;
//! }
//! });
//! }
//! }).unwrap();
//! }
//! }
//! });
//! }
//! }).unwrap();
//! ```
//!
//! [RwLock]: https://doc.rust-lang.org/std/sync/struct.RwLock.html
Expand Down
2 changes: 1 addition & 1 deletion src/strategy/rw_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<T: RefCnt> CaS<T> for RwLock<()> {
new: T,
) -> Self::Protected {
let _lock = self.write();
let cur = current.as_raw() as *mut T::Base;
let cur = current.as_raw();
let new = T::into_ptr(new);
let swapped = storage.compare_exchange(cur, new, Ordering::AcqRel, Ordering::Relaxed);
let old = match swapped {
Expand Down

2 comments on commit facb839

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Track benchmarks

Benchmark suite Current: facb839 Previous: a6d4b0e Ratio
uncontended/load 6 ns/iter (± 0) 6 ns/iter (± 0) 1
uncontended/load_full 9 ns/iter (± 0) 9 ns/iter (± 0) 1
uncontended/load_many 14 ns/iter (± 0) 16 ns/iter (± 0) 0.88
uncontended/store 53 ns/iter (± 0) 53 ns/iter (± 0) 1
uncontended/cache 0 ns/iter (± 0) 0 ns/iter (± 0) NaN
concurrent_loads/load 12 ns/iter (± 0) 12 ns/iter (± 0) 1
concurrent_loads/load_full 12 ns/iter (± 0) 12 ns/iter (± 0) 1
concurrent_loads/load_many 23 ns/iter (± 0) 24 ns/iter (± 0) 0.96
concurrent_loads/store 531 ns/iter (± 1) 511 ns/iter (± 6) 1.04
concurrent_loads/cache 1 ns/iter (± 0) 0 ns/iter (± 0) Infinity
concurrent_store/load 53 ns/iter (± 1) 50 ns/iter (± 1) 1.06
concurrent_store/load_full 60 ns/iter (± 1) 72 ns/iter (± 2) 0.83
concurrent_store/load_many 82 ns/iter (± 2) 88 ns/iter (± 0) 0.93
concurrent_store/store 609 ns/iter (± 11) 559 ns/iter (± 8) 1.09
concurrent_store/cache 1 ns/iter (± 0) 1 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Track benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: facb839 Previous: a6d4b0e Ratio
concurrent_loads/cache 1 ns/iter (± 0) 0 ns/iter (± 0) Infinity

This comment was automatically generated by workflow using github-action-benchmark.

CC: @vorner

Please sign in to comment.