summary refs log tree commit diff
path: root/src/linux.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-02-13 16:42:54 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-15 14:07:21 -0800
commitfa70171dfcef8685faab2508f12514c05ea9453f (patch)
tree3c51778df6cf267f96b88ff8907f3c3978b14e69 /src/linux.rs
parentb795280ddcd9d290d89ff0e284bc12ae91640baf (diff)
downloadcrosvm-fa70171dfcef8685faab2508f12514c05ea9453f.tar
crosvm-fa70171dfcef8685faab2508f12514c05ea9453f.tar.gz
crosvm-fa70171dfcef8685faab2508f12514c05ea9453f.tar.bz2
crosvm-fa70171dfcef8685faab2508f12514c05ea9453f.tar.lz
crosvm-fa70171dfcef8685faab2508f12514c05ea9453f.tar.xz
crosvm-fa70171dfcef8685faab2508f12514c05ea9453f.tar.zst
crosvm-fa70171dfcef8685faab2508f12514c05ea9453f.zip
linux: Tweak wl device setup when building without gpu
I was skimming the gpu flag code (tpm will need something similar) and
found the way resource_bridge_wl_socket is used misleading. The same
variable is declared in two different places depending on whether
building with gpu. This CL combines them into one `let` statement.

Also moved the generic param onto None which comes out more readable
after rustfmt while still providing helpful context for the reader.

TEST=cargo check && cargo check --features gpu

Change-Id: I57a1ae214947475efa7bf01ab123a71a58411244
Reviewed-on: https://chromium-review.googlesource.com/1470915
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'src/linux.rs')
-rw-r--r--src/linux.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/linux.rs b/src/linux.rs
index 1dbd8fd..762b882 100644
--- a/src/linux.rs
+++ b/src/linux.rs
@@ -488,10 +488,10 @@ fn create_virtio_devs(
         }
     }
 
-    #[cfg(feature = "gpu")]
-    let mut resource_bridge_wl_socket: Option<
-        devices::virtio::resource_bridge::ResourceRequestSocket,
-    > = None;
+    #[cfg_attr(not(feature = "gpu"), allow(unused_mut))]
+    let mut resource_bridge_wl_socket =
+        None::<devices::virtio::resource_bridge::ResourceRequestSocket>;
+
     #[cfg(feature = "gpu")]
     {
         if cfg.gpu {
@@ -591,9 +591,6 @@ fn create_virtio_devs(
         let jailed_wayland_dir = Path::new("/wayland");
         let jailed_wayland_path = jailed_wayland_dir.join(wayland_socket_name);
 
-        #[cfg(not(feature = "gpu"))]
-        let resource_bridge_wl_socket = None;
-
         let wl_box = Box::new(
             devices::virtio::Wl::new(
                 if cfg.multiprocess {