Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Clean up state matching in from_state_proto using let/else statements
Max Brunsfeldf99f581bfc50
diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rsindex cdabf7193bc..6a22c0e2891 100644--- a/crates/editor/src/items.rs+++ b/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