build: Fix beta clippy issue (unnecessary_cast)

warning: casting raw pointers to the same type and constness is unnecessary (`*const protocol::MemoryRange` -> `*const protocol::MemoryRange`)
   --> vm-migration/src/protocol.rs:280:17
    |
280 |                 self.data.as_ptr() as *const MemoryRange as *const u8,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.data.as_ptr()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
    = note: `#[warn(clippy::unnecessary_cast)]` on by default

Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
This commit is contained in:
Yu Li
2023-07-12 12:02:38 +08:00
committed by Bo Chen
parent 9abf8d6868
commit aac614e2ec
4 changed files with 11 additions and 14 deletions

View File

@@ -276,10 +276,7 @@ impl MemoryRangeTable {
pub fn write_to(&self, fd: &mut dyn Write) -> Result<(), MigratableError> {
// SAFETY: the slice is construted with the correct arguments
fd.write_all(unsafe {
std::slice::from_raw_parts(
self.data.as_ptr() as *const MemoryRange as *const u8,
self.length() as usize,
)
std::slice::from_raw_parts(self.data.as_ptr() as *const u8, self.length() as usize)
})
.map_err(MigratableError::MigrateSocket)
}