Appease clippy

```
  warning: transmute used without annotations
     --> aya-log-common/src/lib.rs:220:41
      |
  220 |         let bytes = unsafe { core::mem::transmute::<_, [u8; 16]>(self) };
      |                                         ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider adding missing annotations: `transmute::<[u16; 8], [u8; 16]>`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations
      = note: `#[warn(clippy::missing_transmute_annotations)]` on by default

  error: transmute used without annotations
      --> aya/src/maps/mod.rs:1130:52
       |
  1130 |                     .copy_from_slice(unsafe { mem::transmute(TEST_NAME) });
       |                                                    ^^^^^^^^^ help: consider adding missing annotations: `transmute::<&str, &[i8]>`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations
  note: the lint level is defined here
      --> aya/src/lib.rs:41:5
       |
  41   |     clippy::all,
       |     ^^^^^^^^^^^
       = note: `#[deny(clippy::missing_transmute_annotations)]` implied by `#[deny(clippy::all)]`
```
reviewable/pr922/r1
Tamir Duberstein 1 year ago
parent af1a9b3911
commit 04cdcc6973
No known key found for this signature in database

@ -217,7 +217,7 @@ impl WriteToBuf for [u16; 8] {
// compile-time constant.
#[inline(never)]
fn write(self, buf: &mut [u8]) -> Option<NonZeroUsize> {
let bytes = unsafe { core::mem::transmute::<_, [u8; 16]>(self) };
let bytes = unsafe { core::mem::transmute::<[u16; 8], [u8; 16]>(self) };
write(Argument::ArrU16Len8.into(), &bytes, buf)
}
}

@ -1127,7 +1127,7 @@ mod tests {
);
let map_info = unsafe { &mut *(attr.info.info as *mut bpf_map_info) };
map_info.name[..TEST_NAME.len()]
.copy_from_slice(unsafe { mem::transmute(TEST_NAME) });
.copy_from_slice(unsafe { mem::transmute::<&[u8], &[i8]>(TEST_NAME.as_bytes()) });
Ok(0)
}
_ => Err((-1, io::Error::from_raw_os_error(EFAULT))),

Loading…
Cancel
Save