Clean up implementation of ComputeNode::has_feature()

Option::is_some_and() is perfect for what this function does.

Signed-off-by: Tristan Partin <tristan@neon.tech>
This commit is contained in:
Tristan Partin
2025-05-20 14:34:15 -05:00
parent 681edf3983
commit c37ce9b69c

View File

@@ -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) {