Skip to content

Commit c29d2c7

Browse files
bonzinijiangliu
authored andcommitted
volatile_memory: simplify Ok(...)?
Extracting the contents of the Error and putting them back into a new error is unnecessary. Cleanup the code. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent d8e473c commit c29d2c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/volatile_memory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ impl Bytes<usize> for VolatileSlice<'_> {
489489
// volatile. Writing to it with what compiles down to a memcpy
490490
// won't hurt anything as long as we get the bounds checks right.
491491
let mut slice: &mut [u8] = &mut self.as_mut_slice()[addr..];
492-
Ok(slice.write(buf).map_err(Error::IOError)?)
492+
slice.write(buf).map_err(Error::IOError)
493493
}
494494
}
495495

@@ -515,7 +515,7 @@ impl Bytes<usize> for VolatileSlice<'_> {
515515
// volatile. Writing to it with what compiles down to a memcpy
516516
// won't hurt anything as long as we get the bounds checks right.
517517
let slice: &[u8] = &self.as_slice()[addr..];
518-
Ok(buf.write(slice).map_err(Error::IOError)?)
518+
buf.write(slice).map_err(Error::IOError)
519519
}
520520
}
521521

0 commit comments

Comments
 (0)