data_model: fix style by running cargo fmt
@@ -45,10 +45,12 @@ impl fmt::Display for VolatileMemoryError {
write!(f, "address 0x{:x} is out of bounds", addr)
}
&VolatileMemoryError::Overflow { base, offset } => {
- write!(f,
+ write!(
+ f,
"address 0x{:x} offset by 0x{:x} would overflow",
base,
- offset)
+ offset
+ )
}
}
}
@@ -109,7 +111,9 @@ impl<'a> VolatileMemory for &'a mut [u8] {
if mem_end > self.len() {
return Err(Error::OutOfBounds { addr: mem_end });
}
- Ok(unsafe { VolatileSlice::new((self.as_ptr() as usize + offset) as *mut _, count) })
+ Ok(unsafe {
+ VolatileSlice::new((self.as_ptr() as usize + offset) as *mut _, count)
+ })
}
}
@@ -170,7 +174,8 @@ impl<'a> VolatileSlice<'a> {
/// # }
/// ```
pub fn copy_to<T>(&self, buf: &mut [T])
- where T: DataInit
+ where
+ T: DataInit,
{
let mut addr = self.addr;
for v in buf.iter_mut().take(self.size / size_of::<T>()) {
@@ -205,7 +210,8 @@ impl<'a> VolatileSlice<'a> {
/// # }
/// ```
pub fn copy_from<T>(&self, buf: &[T])
- where T: DataInit
+ where
+ T: DataInit,
{
let mut addr = self.addr;
for &v in buf.iter().take(self.size / size_of::<T>()) {
@@ -361,7 +367,8 @@ impl<'a> VolatileMemory for VolatileSlice<'a> {
/// assert_eq!(v, 500);
#[derive(Debug)]
pub struct VolatileRef<'a, T: DataInit>
- where T: 'a
+where
+ T: 'a,
{
addr: *mut T,
phantom: PhantomData<&'a T>,
@@ -550,11 +557,13 @@ mod tests {
use std::usize::MAX;
let a = VecMem::new(1);
let res = a.get_slice(MAX, 1).unwrap_err();
- assert_eq!(res,
+ assert_eq!(
+ res,
Error::Overflow {
base: MAX,
offset: 1,
- });
+ }
+ );
}
#[test]
@@ -570,11 +579,13 @@ mod tests {
use std::usize::MAX;
let a = VecMem::new(1);
let res = a.get_ref::<u8>(MAX).unwrap_err();
- assert_eq!(res,
+ assert_eq!(
+ res,
Error::Overflow {
base: MAX,
offset: 1,
- });
+ }
+ );
}
#[test]
