Clean up state matching in from_state_proto using let/else statements

Max Brunsfeld created

Change summary

crates/editor/src/items.rs | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

Detailed changes

crates/editor/src/items.rs 🔗

@@ -43,15 +43,8 @@ impl FollowableItem for Editor {
         state: &mut Option<proto::view::Variant>,
         cx: &mut MutableAppContext,
     ) -> Option<Task<Result<ViewHandle<Self>>>> {
-        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