From f99f581bfc50b72945d585e8810f4d7be42ab8e8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 14 Dec 2022 11:09:33 -0800 Subject: [PATCH] Clean up state matching in from_state_proto using let/else statements --- crates/editor/src/items.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index cdabf7193b..6a22c0e289 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -43,15 +43,8 @@ impl FollowableItem for Editor { state: &mut Option, cx: &mut MutableAppContext, ) -> Option>>> { - let state = if matches!(state, Some(proto::view::Variant::Editor(_))) { - if let Some(proto::view::Variant::Editor(state)) = state.take() { - state - } else { - unreachable!() - } - } else { - return None; - }; + let Some(proto::view::Variant::Editor(_)) = state else { return None }; + let Some(proto::view::Variant::Editor(state)) = state.take() else { unreachable!() }; let replica_id = project.read(cx).replica_id(); let buffer_ids = state