on master help sign in
ui: unsafe theme_ref is no longer needed.
513effdBlaž Hrastnik
helix-term/src/ui/editor.rs+1−7
@@ -416,16 +416,10 @@ impl Component for EditorView {
416 }
416 }
417
417
418 fn render(&self, mut area: Rect, surface: &mut Surface, cx: &mut Context) {
418 fn render(&self, mut area: Rect, surface: &mut Surface, cx: &mut Context) {
419− // SAFETY: we cheat around the view_mut() borrow because it doesn't allow us to also borrow
420− // theme. Theme is immutable mutating view won't disrupt theme_ref.
421− let theme_ref = unsafe { &*(&cx.editor.theme as *const Theme) };
422−
423 for (view, is_focused) in cx.editor.tree.views() {
419 for (view, is_focused) in cx.editor.tree.views() {
424 // TODO: use parent area
420 // TODO: use parent area
425− self.render_view(view, view.area, surface, theme_ref, is_focused);
421+ self.render_view(view, view.area, surface, &cx.editor.theme, is_focused);
426 }
422 }
427−
428− // TODO: drop unwrap
429 }
423 }
430
424
431 fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {
425 fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {