From 8174f0cde13957f3f9fddc667c6bb0519a26d8d9 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Sat, 5 Oct 2019 00:24:47 -0400 Subject: [PATCH] Fix formatting --- src/client/concurrent/atomic_buffer.rs | 22 +++++----------------- src/client/concurrent/ring_buffer.rs | 4 +++- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/client/concurrent/atomic_buffer.rs b/src/client/concurrent/atomic_buffer.rs index 891361f..9c0abfc 100644 --- a/src/client/concurrent/atomic_buffer.rs +++ b/src/client/concurrent/atomic_buffer.rs @@ -47,7 +47,7 @@ impl<'a> AtomicBuffer<'a> { fn overlay_volatile(&self, offset: IndexT) -> Result where - T: Copy + T: Copy, { self.bounds_check::(offset).map(|_| { let offset_ptr = unsafe { self.buffer.as_ptr().offset(offset as isize) }; @@ -182,10 +182,7 @@ mod tests { let mut atomic_buf = AtomicBuffer::wrap(&mut buf); atomic_buf.put_i64_ordered(0, 12).unwrap(); - assert_eq!( - atomic_buf.get_i64_volatile(0), - Ok(12) - ) + assert_eq!(atomic_buf.get_i64_volatile(0), Ok(12)) } #[test] @@ -195,17 +192,8 @@ mod tests { atomic_buf.get_and_add_i64(0, 1).unwrap(); - assert_eq!( - atomic_buf.compare_and_set_i64(0, 0, 1), - Ok(false) - ); - assert_eq!( - atomic_buf.compare_and_set_i64(0, 1, 2), - Ok(true) - ); - assert_eq!( - atomic_buf.get_i64_volatile(0), - Ok(2) - ); + assert_eq!(atomic_buf.compare_and_set_i64(0, 0, 1), Ok(false)); + assert_eq!(atomic_buf.compare_and_set_i64(0, 1, 2), Ok(true)); + assert_eq!(atomic_buf.get_i64_volatile(0), Ok(2)); } } diff --git a/src/client/concurrent/ring_buffer.rs b/src/client/concurrent/ring_buffer.rs index 27ff6d3..2a9bdd9 100644 --- a/src/client/concurrent/ring_buffer.rs +++ b/src/client/concurrent/ring_buffer.rs @@ -216,7 +216,9 @@ mod tests { ring_buf.claim_capacity(16).unwrap(); assert_eq!( - ring_buf.buffer.get_i64_volatile(ring_buf.tail_position_index), + ring_buf + .buffer + .get_i64_volatile(ring_buf.tail_position_index), Ok(16) );