From b1a657f905422a33447342944761f48632022faf Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 11 Apr 2020 19:47:40 +0000 Subject: crosvm: collapse simple boolean matches Rust 1.42 introduces matches!(), which can be used to collapse simple match statements like these. --- src/main.rs | 5 +---- src/plugin/vcpu.rs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src') 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) -> 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] { -- cgit 1.4.1