1
0
mirror of https://github.com/bspeice/aeron-rs synced 2024-12-21 21:38:09 -05:00

Fix formatting

This commit is contained in:
Bradlee Speice 2019-10-05 00:24:47 -04:00
parent 3ae7e6176c
commit 8174f0cde1
2 changed files with 8 additions and 18 deletions

View File

@ -47,7 +47,7 @@ impl<'a> AtomicBuffer<'a> {
fn overlay_volatile<T>(&self, offset: IndexT) -> Result<T> fn overlay_volatile<T>(&self, offset: IndexT) -> Result<T>
where where
T: Copy T: Copy,
{ {
self.bounds_check::<T>(offset).map(|_| { self.bounds_check::<T>(offset).map(|_| {
let offset_ptr = unsafe { self.buffer.as_ptr().offset(offset as isize) }; 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); let mut atomic_buf = AtomicBuffer::wrap(&mut buf);
atomic_buf.put_i64_ordered(0, 12).unwrap(); atomic_buf.put_i64_ordered(0, 12).unwrap();
assert_eq!( assert_eq!(atomic_buf.get_i64_volatile(0), Ok(12))
atomic_buf.get_i64_volatile(0),
Ok(12)
)
} }
#[test] #[test]
@ -195,17 +192,8 @@ mod tests {
atomic_buf.get_and_add_i64(0, 1).unwrap(); atomic_buf.get_and_add_i64(0, 1).unwrap();
assert_eq!( assert_eq!(atomic_buf.compare_and_set_i64(0, 0, 1), Ok(false));
atomic_buf.compare_and_set_i64(0, 0, 1), assert_eq!(atomic_buf.compare_and_set_i64(0, 1, 2), Ok(true));
Ok(false) assert_eq!(atomic_buf.get_i64_volatile(0), Ok(2));
);
assert_eq!(
atomic_buf.compare_and_set_i64(0, 1, 2),
Ok(true)
);
assert_eq!(
atomic_buf.get_i64_volatile(0),
Ok(2)
);
} }
} }

View File

@ -216,7 +216,9 @@ mod tests {
ring_buf.claim_capacity(16).unwrap(); ring_buf.claim_capacity(16).unwrap();
assert_eq!( 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) Ok(16)
); );