From c37ce9b69c64ae93af97d0bbf19b1e01b7d68587 Mon Sep 17 00:00:00 2001 From: Tristan Partin Date: Tue, 20 May 2025 14:34:15 -0500 Subject: [PATCH] Clean up implementation of ComputeNode::has_feature() Option::is_some_and() is perfect for what this function does. Signed-off-by: Tristan Partin --- compute_tools/src/compute.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/compute_tools/src/compute.rs b/compute_tools/src/compute.rs index bf6a88261a..7b6f923f7d 100644 --- a/compute_tools/src/compute.rs +++ b/compute_tools/src/compute.rs @@ -889,13 +889,12 @@ impl ComputeNode { /// Check that compute node has corresponding feature enabled. pub fn has_feature(&self, feature: ComputeFeature) -> bool { - let state = self.state.lock().unwrap(); - - if let Some(s) = state.pspec.as_ref() { - s.spec.features.contains(&feature) - } else { - false - } + self.state + .lock() + .unwrap() + .pspec + .as_ref() + .is_some_and(|s| s.spec.features.contains(&feature)) } pub fn set_status(&self, status: ComputeStatus) {