Avoid unnecessary match

This commit is contained in:
Joseph T. Lyons 2023-12-13 21:43:21 -05:00
parent 4f196f66fc
commit 837b4c3462

View file

@ -160,23 +160,19 @@ impl FeedbackModal {
editor editor
}); });
cx.subscribe( cx.subscribe(&feedback_editor, |this, editor, event: &EditorEvent, cx| {
&feedback_editor, if *event == EditorEvent::Edited {
|this, editor, event: &EditorEvent, cx| match event { this.character_count = editor
EditorEvent::Edited => { .read(cx)
this.character_count = editor .buffer()
.read(cx) .read(cx)
.buffer() .as_singleton()
.read(cx) .expect("Feedback editor is never a multi-buffer")
.as_singleton() .read(cx)
.expect("Feedback editor is never a multi-buffer") .len() as i32;
.read(cx) cx.notify();
.len() as i32; }
cx.notify(); })
}
_ => {}
},
)
.detach(); .detach();
Self { Self {