From 999afb0356c840f315a7317618a76a793c92b3d5 Mon Sep 17 00:00:00 2001 From: Greg Colombo Date: Tue, 4 Jun 2024 19:36:37 +0000 Subject: [PATCH] remove unnecessary unwrap --- nexus/src/app/sagas/instance_common.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/nexus/src/app/sagas/instance_common.rs b/nexus/src/app/sagas/instance_common.rs index 54ad9cc587..8b8f0dc1dd 100644 --- a/nexus/src/app/sagas/instance_common.rs +++ b/nexus/src/app/sagas/instance_common.rs @@ -287,15 +287,13 @@ pub async fn instance_ip_get_instance_state( // block the attach/detach. ( InstanceState::Vmm, - Some(VmmState::Starting) - | Some(VmmState::Migrating) - | Some(VmmState::Stopping) - | Some(VmmState::Stopped), + Some(state @ VmmState::Starting) + | Some(state @ VmmState::Migrating) + | Some(state @ VmmState::Stopping) + | Some(state @ VmmState::Stopped), ) => { - // Unwrapping is safe since all the matched VMM states are Some. - let found_vmm_state = found_vmm_state.unwrap(); return Err(ActionError::action_failed(Error::unavail(&format!( - "can't {verb} in transient state {found_vmm_state}" + "can't {verb} in transient state {state}" )))); } (InstanceState::Destroyed, _) => {