diff options
author | David Tolnay <dtolnay@chromium.org> | 2019-04-15 15:56:35 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-18 19:51:01 -0700 |
commit | 64cd5eae5778b86f6e498a6fa1b1962693aa5a46 (patch) | |
tree | 9b68f7fce3385c410f4fd9c4e978660a9b5a0973 /src/linux.rs | |
parent | b1de6323ab8c96c52a60e0ff735e4bbb8a8464c9 (diff) | |
download | crosvm-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/linux.rs')
-rw-r--r-- | src/linux.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/linux.rs b/src/linux.rs index 7ece6e3..977f7bf 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -164,8 +164,8 @@ impl Display for Error { Disk(e) => write!(f, "failed to load disk image: {}", e), DiskImageLock(e) => write!(f, "failed to lock disk image: {}", e), DropCapabilities(e) => write!(f, "failed to drop process capabilities: {}", e), - InputDeviceNew(ref e) => write!(f, "failed to set up input device: {}", e), - InputEventsOpen(ref e) => write!(f, "failed to open event device: {}", e), + InputDeviceNew(e) => write!(f, "failed to set up input device: {}", e), + InputEventsOpen(e) => write!(f, "failed to open event device: {}", e), InvalidFdPath => write!(f, "failed parsing a /proc/self/fd/*"), InvalidWaylandPath => write!(f, "wayland socket path has no parent or file name"), IoJail(e) => write!(f, "{}", e), @@ -1275,7 +1275,7 @@ fn run_control( // Watch for low memory notifications and take memory back from the VM. let low_mem = File::open("/dev/chromeos-low-mem").ok(); - if let Some(ref low_mem) = low_mem { + if let Some(low_mem) = &low_mem { poll_ctx .add(low_mem, Token::LowMemory) .map_err(Error::PollContextAdd)?; @@ -1415,7 +1415,7 @@ fn run_control( } } Token::LowMemory => { - if let Some(ref low_mem) = low_mem { + if let Some(low_mem) = &low_mem { let old_balloon_memory = current_balloon_memory; current_balloon_memory = min( current_balloon_memory + balloon_memory_increment, @@ -1453,7 +1453,7 @@ fn run_control( // Acknowledge the timer. lowmem_timer.wait().map_err(Error::TimerFd)?; - if let Some(ref low_mem) = low_mem { + if let Some(low_mem) = &low_mem { // Start polling the lowmem device again. poll_ctx .add(low_mem, Token::LowMemory) |