Skip to content

Commit 2f4e96c

Browse files
committed
clippy: allow mut_from_ref
The purpose of the function is exactly to change a pointer obtained from a mutable VolatileSlice into a reference, and doing so is unsafe. So just shut up clippy. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent a710aa6 commit 2f4e96c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- \[[#327](https://github.com/rust-vmm/vm-memory/pull/327)\] I/O virtual memory support via `IoMemory`, `IommuMemory`, and `Iommu`/`Iotlb`
88

9+
### Fixed
10+
11+
- \[[#361](https://github.com/rust-vmm/vm-memory/pull/361)\] clippy: allow mut_from_ref
12+
913
## \[v0.17.1\]
1014

1115
No visible changes.

src/volatile_memory.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ pub trait VolatileMemory {
228228
///
229229
/// If the resulting pointer is not aligned, this method will return an
230230
/// [`Error`](enum.Error.html).
231+
// the function is unsafe, and the conversion is safe if following the safety
232+
// instrutions above
233+
#[allow(clippy::mut_from_ref)]
231234
unsafe fn aligned_as_mut<T: ByteValued>(&self, offset: usize) -> Result<&mut T> {
232235
let slice = self.get_slice(offset, size_of::<T>())?;
233236
slice.check_alignment(align_of::<T>())?;

0 commit comments

Comments
 (0)