Fixed warnings generated by rustc 1.57.0 am: 641fc4a280

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1908510

Change-Id: I73a92d605f4e8ba740feb3f2cc28070a867a0963
diff --git a/apkverify/src/sigutil.rs b/apkverify/src/sigutil.rs
index fc92898..23dd91e 100644
--- a/apkverify/src/sigutil.rs
+++ b/apkverify/src/sigutil.rs
@@ -104,8 +104,8 @@
             let mut data = data(self)?;
             while data.limit() > 0 {
                 let chunk_size = min(CHUNK_SIZE_BYTES, data.limit());
-                let mut slice = &mut chunk[..(chunk_size as usize)];
-                data.read_exact(&mut slice)?;
+                let slice = &mut chunk[..(chunk_size as usize)];
+                data.read_exact(slice)?;
                 digests_of_chunks.put_slice(
                     digester.digest(slice, CHUNK_HEADER_MID, chunk_size as u32).as_ref(),
                 );
diff --git a/authfs/fd_server/src/aidl.rs b/authfs/fd_server/src/aidl.rs
index 92be504..ddac2bc 100644
--- a/authfs/fd_server/src/aidl.rs
+++ b/authfs/fd_server/src/aidl.rs
@@ -110,8 +110,8 @@
         F: FnOnce(&mut FdConfig) -> BinderResult<(i32, FdConfig)>,
     {
         let mut fd_pool = self.fd_pool.lock().unwrap();
-        let mut fd_config = fd_pool.get_mut(&fd).ok_or_else(|| new_errno_error(Errno::EBADF))?;
-        let (new_fd, new_fd_config) = create_fn(&mut fd_config)?;
+        let fd_config = fd_pool.get_mut(&fd).ok_or_else(|| new_errno_error(Errno::EBADF))?;
+        let (new_fd, new_fd_config) = create_fn(fd_config)?;
         if let btree_map::Entry::Vacant(entry) = fd_pool.entry(new_fd) {
             entry.insert(new_fd_config);
             Ok(new_fd)
diff --git a/authfs/src/fusefs.rs b/authfs/src/fusefs.rs
index 89bac45..549df1e 100644
--- a/authfs/src/fusefs.rs
+++ b/authfs/src/fusefs.rs
@@ -215,13 +215,13 @@
         F: FnOnce(&mut AuthFsEntry, &Path, Inode) -> io::Result<AuthFsEntry>,
     {
         let mut inode_table = self.inode_table.lock().unwrap();
-        let mut parent_entry = inode_table
+        let parent_entry = inode_table
             .get_mut(&parent_inode)
             .ok_or_else(|| io::Error::from_raw_os_error(libc::ENOENT))?;
 
         let new_inode = self.next_inode.fetch_add(1, Ordering::Relaxed);
         let basename: &Path = cstr_to_path(name);
-        let new_file_entry = create_fn(&mut parent_entry, basename, new_inode)?;
+        let new_file_entry = create_fn(parent_entry, basename, new_inode)?;
         if let btree_map::Entry::Vacant(entry) = inode_table.entry(new_inode) {
             entry.insert(new_file_entry);
             Ok(new_inode)
diff --git a/compos/common/compos_client.rs b/compos/common/compos_client.rs
index 4908f94..9e419f5 100644
--- a/compos/common/compos_client.rs
+++ b/compos/common/compos_client.rs
@@ -199,18 +199,12 @@
     }
 }
 
-#[derive(Debug)]
+#[derive(Debug, Default)]
 struct VmState {
     has_died: bool,
     cid: Option<i32>,
 }
 
-impl Default for VmState {
-    fn default() -> Self {
-        Self { has_died: false, cid: None }
-    }
-}
-
 #[derive(Debug)]
 struct VmStateMonitor {
     mutex: Mutex<VmState>,
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs
index af420f6..e6210e2 100644
--- a/virtualizationservice/src/aidl.rs
+++ b/virtualizationservice/src/aidl.rs
@@ -644,6 +644,7 @@
 struct VirtualMachine {
     instance: Arc<VmInstance>,
     /// Keeps our service process running as long as this VM instance exists.
+    #[allow(dead_code)]
     lazy_service_guard: LazyServiceGuard,
 }
 
@@ -775,7 +776,7 @@
 
 /// The mutable state of the VirtualizationService. There should only be one instance of this
 /// struct.
-#[derive(Debug)]
+#[derive(Debug, Default)]
 struct State {
     /// The VMs which have been started. When VMs are started a weak reference is added to this list
     /// while a strong reference is returned to the caller over Binder. Once all copies of the
@@ -822,12 +823,6 @@
     }
 }
 
-impl Default for State {
-    fn default() -> Self {
-        State { vms: vec![], debug_held_vms: vec![] }
-    }
-}
-
 /// Get the next available CID, or an error if we have run out. The last CID used is stored in
 /// a system property so that restart of virtualizationservice doesn't reuse CID while the host
 /// Android is up.