summary refs log tree commit diff
path: root/src/plugin
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-04-15 15:56:35 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-18 19:51:01 -0700
commit64cd5eae5778b86f6e498a6fa1b1962693aa5a46 (patch)
tree9b68f7fce3385c410f4fd9c4e978660a9b5a0973 /src/plugin
parentb1de6323ab8c96c52a60e0ff735e4bbb8a8464c9 (diff)
downloadcrosvm-64cd5eae5778b86f6e498a6fa1b1962693aa5a46.tar
crosvm-64cd5eae5778b86f6e498a6fa1b1962693aa5a46.tar.gz
crosvm-64cd5eae5778b86f6e498a6fa1b1962693aa5a46.tar.bz2
crosvm-64cd5eae5778b86f6e498a6fa1b1962693aa5a46.tar.lz
crosvm-64cd5eae5778b86f6e498a6fa1b1962693aa5a46.tar.xz
crosvm-64cd5eae5778b86f6e498a6fa1b1962693aa5a46.tar.zst
crosvm-64cd5eae5778b86f6e498a6fa1b1962693aa5a46.zip
edition: Eliminate ref keyword
As described in:
https://doc.rust-lang.org/edition-guide/rust-2018/ownership-and-lifetimes/default-match-bindings.html
which also covers the new mental model that the Rust Book will use for
teaching binding modes and has been found to be more friendly for both
beginners and experienced users.

Before:

    match *opt {
        Some(ref v) => ...,
        None => ...,
    }

After:

    match opt {
        Some(v) => ...,
        None => ...,
    }

TEST=cargo check --all-features
TEST=local kokoro

Change-Id: I3c5800a9be36aaf5d3290ae3bd3116f699cb00b7
Reviewed-on: https://chromium-review.googlesource.com/1566669
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'src/plugin')
-rw-r--r--src/plugin/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugin/mod.rs b/src/plugin/mod.rs
index c01ff80..beedea4 100644
--- a/src/plugin/mod.rs
+++ b/src/plugin/mod.rs
@@ -467,8 +467,8 @@ pub fn run_config(cfg: Config) -> Result<()> {
 
     let jail = if cfg.sandbox {
         // An empty directory for jailed plugin pivot root.
-        let root_path = match cfg.plugin_root {
-            Some(ref dir) => Path::new(dir),
+        let root_path = match &cfg.plugin_root {
+            Some(dir) => dir,
             None => Path::new("/var/empty"),
         };
 
@@ -599,7 +599,7 @@ pub fn run_config(cfg: Config) -> Result<()> {
         let plugin_socket_count = plugin.sockets().len();
         let events = {
             let poll_res = match dying_instant {
-                Some(ref inst) => poll_ctx.wait_timeout(duration_to_die - inst.elapsed()),
+                Some(inst) => poll_ctx.wait_timeout(duration_to_die - inst.elapsed()),
                 None => poll_ctx.wait(),
             };
             match poll_res {