diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-04-11 19:47:40 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-04-11 19:55:13 +0000 |
commit | b1a657f905422a33447342944761f48632022faf (patch) | |
tree | 45db910ebdd0f84798463707a6264d8e320aa77c /src | |
parent | 5ba2568bff628620aa993a8f64b9e1dcf25928f4 (diff) | |
download | crosvm-b1a657f905422a33447342944761f48632022faf.tar crosvm-b1a657f905422a33447342944761f48632022faf.tar.gz crosvm-b1a657f905422a33447342944761f48632022faf.tar.bz2 crosvm-b1a657f905422a33447342944761f48632022faf.tar.lz crosvm-b1a657f905422a33447342944761f48632022faf.tar.xz crosvm-b1a657f905422a33447342944761f48632022faf.tar.zst crosvm-b1a657f905422a33447342944761f48632022faf.zip |
crosvm: collapse simple boolean matches
Rust 1.42 introduces matches!(), which can be used to collapse simple match statements like these.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 5 | ||||
-rw-r--r-- | src/plugin/vcpu.rs | 5 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 144e49c..e33be66 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,10 +38,7 @@ use vm_control::{ }; fn executable_is_plugin(executable: &Option<Executable>) -> bool { - match executable { - Some(Executable::Plugin(_)) => true, - _ => false, - } + matches!(executable, Some(Executable::Plugin(_))) } // Wait for all children to exit. Return true if they have all exited, false diff --git a/src/plugin/vcpu.rs b/src/plugin/vcpu.rs index 3bb6bed..a5bf73c 100644 --- a/src/plugin/vcpu.rs +++ b/src/plugin/vcpu.rs @@ -323,10 +323,7 @@ enum VcpuRunData<'a> { impl<'a> VcpuRunData<'a> { fn is_write(&self) -> bool { - match self { - VcpuRunData::Write(_) => true, - _ => false, - } + matches!(self, VcpuRunData::Write(_)) } fn as_slice(&self) -> &[u8] { |