Clean up state matching in from_state_proto using let/else statements
This commit is contained in:
parent
09d3fbf04f
commit
f99f581bfc
1 changed files with 2 additions and 9 deletions
|
@ -43,15 +43,8 @@ impl FollowableItem for Editor {
|
||||||
state: &mut Option<proto::view::Variant>,
|
state: &mut Option<proto::view::Variant>,
|
||||||
cx: &mut MutableAppContext,
|
cx: &mut MutableAppContext,
|
||||||
) -> Option<Task<Result<ViewHandle<Self>>>> {
|
) -> Option<Task<Result<ViewHandle<Self>>>> {
|
||||||
let state = if matches!(state, Some(proto::view::Variant::Editor(_))) {
|
let Some(proto::view::Variant::Editor(_)) = state else { return None };
|
||||||
if let Some(proto::view::Variant::Editor(state)) = state.take() {
|
let Some(proto::view::Variant::Editor(state)) = state.take() else { unreachable!() };
|
||||||
state
|
|
||||||
} else {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
let replica_id = project.read(cx).replica_id();
|
let replica_id = project.read(cx).replica_id();
|
||||||
let buffer_ids = state
|
let buffer_ids = state
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue