mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
Fix new warning with rust 1.21
Mutable references being declared mutable themselves is unnecessary and now generates a warning. Change-Id: I29c7652fb86e17a8eda21efc728dd09b726c304f Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/717733 Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
d169a8d9ed
commit
70a8290514
3 changed files with 3 additions and 3 deletions
|
@ -92,7 +92,7 @@ impl Tap {
|
|||
unsafe {
|
||||
let ifrn_name = ifreq.ifr_ifrn.ifrn_name.as_mut();
|
||||
let ifru_flags = ifreq.ifr_ifru.ifru_flags.as_mut();
|
||||
let mut name_slice = &mut ifrn_name[..TUNTAP_DEV_FORMAT.len()];
|
||||
let name_slice = &mut ifrn_name[..TUNTAP_DEV_FORMAT.len()];
|
||||
name_slice.copy_from_slice(TUNTAP_DEV_FORMAT);
|
||||
*ifru_flags = (net_sys::IFF_TAP | net_sys::IFF_NO_PI | net_sys::IFF_VNET_HDR) as
|
||||
c_short;
|
||||
|
|
|
@ -251,7 +251,7 @@ impl MemoryMapping {
|
|||
// It is safe to overwrite the volatile memory. Acessing the guest
|
||||
// memory as a mutable slice is OK because nothing assumes another
|
||||
// thread won't change what is loaded.
|
||||
let mut dst = &mut self.as_mut_slice()[mem_offset..mem_end];
|
||||
let dst = &mut self.as_mut_slice()[mem_offset..mem_end];
|
||||
src.read_exact(dst).map_err(Error::ReadFromSource)?;
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -104,7 +104,7 @@ pub fn setup_msrs(vcpu: &kvm::Vcpu) -> Result<()> {
|
|||
let vec_size_bytes = mem::size_of::<kvm_msrs>() +
|
||||
(entry_vec.len() * mem::size_of::<kvm_msr_entry>());
|
||||
let vec: Vec<u8> = Vec::with_capacity(vec_size_bytes);
|
||||
let mut msrs: &mut kvm_msrs = unsafe {
|
||||
let msrs: &mut kvm_msrs = unsafe {
|
||||
// Converting the vector's memory to a struct is unsafe. Carefully using the read-only
|
||||
// vector to size and set the members ensures no out-of-bounds erros below.
|
||||
&mut *(vec.as_ptr() as *mut kvm_msrs)
|
||||
|
|
Loading…
Reference in a new issue